-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathupload.php
30 lines (22 loc) · 949 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
<?php
include("classes/easy_upload/upload_class.php"); //classes is the map where the class file is stored
$upload = new file_upload();
$upload->upload_dir = 'uploads/';
$upload->extensions = array('.png', '.jpg', '.zip', '.pdf'); // specify the allowed extensions here
$upload->rename_file = true;
if(!empty($_FILES)) {
$upload->the_temp_file = $_FILES['userfile']['tmp_name'];
$upload->the_file = $_FILES['userfile']['name'];
$upload->http_error = $_FILES['userfile']['error'];
$upload->do_filename_check = 'y'; // use this boolean to check for a valid filename
if ($upload->upload()){
echo '<div id="status">success</div>';
echo '<div id="message">'. $upload->file_copy .' Successfully Uploaded</div>';
//return the upload file
echo '<div id="uploadedfile">'. $upload->file_copy .'</div>';
} else {
echo '<div id="status">failed</div>';
echo '<div id="message">'. $upload->show_error_string() .'</div>';
}
}
?>