csvxml/upload.php

30 lines
786 B
PHP
Raw Normal View History

2019-08-25 21:45:52 +02:00
<?PHP
2019-08-30 23:14:18 +02:00
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();
}
2019-08-27 00:31:46 +02:00
//This is our size condition
if ($uploaded_size > 40000000) {
echo "Your file is too large.<br>";
2019-08-30 23:14:18 +02:00
return;
2019-08-27 00:31:46 +02:00
}
//Here we check that $ok was not set to 0 by an error
2019-08-30 23:14:18 +02:00
//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;
2019-08-25 21:45:52 +02:00
}
2019-08-30 23:14:18 +02:00
header("Location: index3.php?fnam=" . basename($_FILES['uploaded']['name']));