Improve error handling for file uploads in upload.php
This commit is contained in:
parent
cb646d82e5
commit
211a1eb319
12
upload.php
12
upload.php
@ -28,13 +28,17 @@ if (!isset($_FILES['uploadFile']) || !is_array($_FILES['uploadFile']))
|
|||||||
|
|
||||||
$file = $_FILES['uploadFile'];
|
$file = $_FILES['uploadFile'];
|
||||||
|
|
||||||
$fileError = isset($file['error']) ? (int)$file['error'] : UPLOAD_ERR_NO_FILE;
|
$fileError = $file['error'];
|
||||||
if ($fileError !== UPLOAD_ERR_OK)
|
|
||||||
{
|
if ($fileError !== UPLOAD_ERR_OK) {
|
||||||
header('Location: account.php?upload=err');
|
echo "UPLOAD ERROR CODE: " . $fileError . "<br>";
|
||||||
|
echo "UPLOAD MAX FILESIZE: " . ini_get('upload_max_filesize') . "<br>";
|
||||||
|
echo "POST MAX SIZE: " . ini_get('post_max_size') . "<br>";
|
||||||
|
var_dump($_FILES);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Basic Validierung
|
// Basic Validierung
|
||||||
$tmp = isset($file['tmp_name']) ? (string)$file['tmp_name'] : '';
|
$tmp = isset($file['tmp_name']) ? (string)$file['tmp_name'] : '';
|
||||||
if ($tmp === '' || !is_uploaded_file($tmp))
|
if ($tmp === '' || !is_uploaded_file($tmp))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user