-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileUploadProcess.php
More file actions
30 lines (26 loc) · 834 Bytes
/
fileUploadProcess.php
File metadata and controls
30 lines (26 loc) · 834 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
<?php
if( isset($_FILES['gpsImage']) ) {
$permType = array( 'image/gif', 'image/jpeg', 'image/pjpeg' );
$file = $_FILES['gpsImage'];
if( in_array( $file['type'], $permType ) && $file['size'] < 5000000 ) {
if ($file["error"] > 0) {
echo "Return Code: " . $file["error"] . "<br />";
} else {
echo "Upload: " . $file["name"] . "<br />";
echo "Type: " . $file["type"] . "<br />";
echo "Size: " . ($file["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $file["tmp_name"] . "<br />";
if (file_exists("imgUpload/" . $file["name"])) {
echo $file["name"] . " already exists. ";
} else {
move_uploaded_file($file["tmp_name"],
"imgUpload/" . $file["name"]);
echo "Stored in: " . "imgUpload/" . $file["name"];
}
header("location: index.php");
}
} else {
echo "Invalid file";
}
}
?>