Fix check for upload size
This commit is contained in:
@ -2,8 +2,14 @@
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
$target = __DIR__ . "/../csv/" . basename($_FILES['uploaded']['name']);
|
||||
if (empty($_FILES)) {
|
||||
throw new MDFileDoesNotExist("No file uploaded");
|
||||
}
|
||||
|
||||
$targetpart = basename($_FILES['uploaded']['name']);
|
||||
$target = __DIR__ . "/../csv/" . $targetpart;
|
||||
|
||||
// TODO: File name needs to be sanitized, or tmp name used
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
@ -14,7 +20,7 @@ if (validateAntiCsrfToken() === false) {
|
||||
}
|
||||
|
||||
//This is our size condition
|
||||
if ($uploaded_size > 40000000) {
|
||||
if ($_FILES['uploaded']['size'] > 40000000) {
|
||||
echo "Your file is too large.<br>";
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user