csvxml/upload.php
Joshua Ramon Enslin 76b5069b15 Fix obsolete, now erroneous type-casting of used memory size to string
for calling human_filesize

phpcs-errors:226 phpunit-status:successful
2020-08-11 13:39:47 +02:00

30 lines
786 B
PHP

<?PHP
declare(strict_types = 1);
require_once __DIR__ . "/functions/functions.php";
$target = "csv/" . basename($_FILES['uploaded']['name']);
$targetpart = basename($_FILES['uploaded']['name']);
if (session_status() != PHP_SESSION_ACTIVE) {
session_start();
}
if (validateAntiCsrfToken() === false) {
throw new WrongCsrfTokenException();
}
//This is our size condition
if ($uploaded_size > 40000000) {
echo "Your file is too large.<br>";
return;
}
//Here we check that $ok was not set to 0 by an error
//If everything is ok we try to upload it
if(!move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
echo "Sorry, there was a problem uploading your file.";
return;
}
header("Location: index3.php?fnam=" . basename($_FILES['uploaded']['name']));