-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
32 lines (30 loc) · 1022 Bytes
/
index.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
<?php
require __DIR__ . '/vendor/autoload.php';
use SimpleUploader\Uploader;
if (isset($_POST['submit'])) {
$max_size = 200 * 1024;
try {
$attachment = new Uploader(__DIR__ . "/uploads");
$attachment->setMaxSize($max_size);
$attachment->setType(array("image/jpeg", "image/png", "image/webp", "image/x-icon", "application/zip", "application/pdf", "application/x-rar-compressed"));
$result = $attachment->upload($_FILES['file_name']);
$messages = $attachment->getMessages();
} catch (Exception $e) {
$exception_error = $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Uploader</title>
<meta charset="utf-8">
</head>
<body>
<h1>upload center:</h1>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<input type="file" name="file_name[]" multiple>
<input type="submit" name="submit" value="upload">
</form>
</body>
</html>