-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
42 lines (29 loc) · 954 Bytes
/
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
<?php
header("Content-Type: text/html; charset=utf-8");
define('STORE_PATH', '/data1/htdocs/www/huahua/store');
set_time_limit(0);
if (is_uploaded_file($_FILES['uploadedfile']['tmp_name'])) {
$upfile = $_FILES['uploadedfile'];
$name = $upfile['name'];
$type = $upfile['type'];
$size = $upfile['size'];
$tmp_name = $upfile['tmp_name'];
if ($_Files['file']['error'] > 0) {
die("Error:". $_FILES['file']['error'] ."</br>");
}
//$new_file = "/data1/htdocs/www/huahua_software/{$name}";
$new_file = STORE_PATH."/{$name}";
if (file_exists($new_file)) {
die("File: ". $name . " already exists.");
}
if (move_uploaded_file($tmp_name, $new_file)) {
echo "Stored Successful. <a href='./index.html'>Continue Upload</a></br></br>";
echo "<a href='./store.php' target='_blank'>view store</a>";
} else {
echo "Upload Failed: ";
print_r(error_get_last());
}
} else {
echo "None file was uploaded!";
}
?>