-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupload.php
87 lines (77 loc) · 2 KB
/
upload.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
<?php
include "security.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" rel="stylesheet">
<title>Upload Manifest</title>
</head>
<body>
<?php
include "header.php";
?>
<br>
<br>
<?php
$s = ""; //for plural files
if (isset ($_GET["error"]))
{
echo '<div class="alert alert-danger" id="alertbad">';
echo "<strong>Error!</strong> {$_GET['error']}";
echo '</div>';
}
else if (isset ($_GET['success']))
{
if ($_GET['success'] >= 1)
{
$s = "s"; //if plural
}
echo '<div class="alert alert-success" id="alertgood">';
echo "<strong>Success!</strong> {$_GET['success']} file{$s} uploaded.";
echo '</div>';
}
?>
<br>
<div class="container">
<form action="doupload.php" method="post" enctype="multipart/form-data" onsubmit="return checkForm(this)";>
<input type="file" id="file" name="files[]" multiple="multiple" minFiles="1" />
<br>
Manifest Name:
<br>
<input type="text" id="inputfield" name="manifestname" />
<br>
<br>
<input class="btn btn-info" type="submit" value="Upload" />
</form>
</div>
<script type="text/javascript">
function checkForm(form)
{
// validation fails if the input is blank
if(form.inputfield.value == "")
{
alert("No manifest name");
form.inputfield.focus();
return false;
}
if(form.file.value == "")
{
alert("No files selected");
form.inputfield.focus();
return false;
}
else
{
// validation was successful
return true;
}
}
</script>
</body>
</html>