-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile_upload.php
More file actions
32 lines (26 loc) · 874 Bytes
/
Copy pathfile_upload.php
File metadata and controls
32 lines (26 loc) · 874 Bytes
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
<form action='' method='POST' enctype='multipart/form-data'>
Select image to upload:
<input type='file' name='file' id='file'>
<input type='submit' id='u_button' name='u_button' value='Upload the File'>
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$file_result=';
if($_FILES['file']['error']>0)
{
$file_result .= 'No file uploaded or invalid file';
$file_result .= 'Error Code: ' . $_FILES['file']['error'] . '< br >';
}
else
{
$file_result .=
'Upload: ' . $_FILES['file']['name'] . '< br >' .
'Type: ' . $_FILES['file']['type'] . '< br >' .
'Size: ' . ($_FILES['file']['size']/1024) . '< br >' .
'Temp File: ' . $_FILES['file']['tmp_name'] . '< br >';
move_uploaded_file($_FILES['file']['tmp_name'], $_FILES['file']['name']);
$file_result .='file uploaded successfully';
}
}
?>