-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadfile.php
109 lines (104 loc) · 3.33 KB
/
uploadfile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
session_start();
if(isset($_GET['id'])) {
$_SESSION['user_psid'] = $_GET["id"];
if(isset($_GET['status'])){
if($_GET['status'] == "err"){
?>
<script>
alert("Fail to upload file, please try again")
</script>
<?php
}
}
}else{
exit();
}
echo "_";
?>
<!DOCTYPE html>
<html>
<head>
<title>Upload Document</title>
<!-- Import polymer HTML files-->
<link rel="import" href="bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/paper-card/paper-card.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-toast/paper-toast.html">
<link rel="import" href="bower_components/paper-item/paper-item.html">
<link rel="import" href="bower_components/paper-header-panel/paper-header-panel.html">
<link rel="import" href="bower_components/font-roboto/roboto.html">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<style is="custom-style">
body {
font-family: Roboto;
}
.center{
max-width: 300px;
max-height: 400px;
margin: auto;
margin-top: 30px;
}
paper-button{
min-width: inherit;
}
.spacer{
@apply(--layout-flex);
}
#file {
margin-bottom: 270px;
}
paper-button {
color: white;
background-color: #65C6BB;
}
.warning {
--paper-toast-background-color: #F7CA18;
--paper-toast-color: white;
}
#helper-text {
font-size: 12px;
display: block;
}
#helper-indicator:hover #helper-text {
display: block;
}
</style>
</head>
<body class="fullbleed vertical layout">
<template is="dom-bind" id="app">
<paper-header-panel class="flex">
<paper-toolbar>
<div><h1> Choose a file <h1></div>
</paper-toolbar>
<div class="center">
<form id="uploadfile" method="POST" action="processfile.php" enctype="multipart/form-data">
<div style="color:grey; margin-bottom:30px;">
<h2 style="margin-bottom: 5px;">Accept ONLY PDF file</h2>
<span id="helper-indicator" style="font-size:12px;">Click <a href="http://smallpdf.com/" label="Convert to PDF">here</a> to convert your file to PDF</span>
</div>
<input name="file" id="file" type="file">
<paper-button raised on-click="submitform">U P L O A D</paper-button>
</form>
<paper-toast id="warning" class="fit-bottom warning" text="Can ONLY print 1 document at a time" opened duration="10000"></paper-toast>
</div>
</paper-header-panel>
</template>
</body>
<script>
//Set the first page
var app = document.querySelector("#app");
app.select = 0;
app.submitform = function(event){
if(this.$.file.files.length == 0){
alert('No file selected');
}
else{
this.$.uploadfile.submit();
}
}
</script>
</html>