Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
42 righe
1.3 KiB
42 righe
1.3 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (isset($_SESSION["utente"])) { |
|
ini_set('memory_limit', '500M'); |
|
|
|
function error_respone() { |
|
$response = [ |
|
'files' => [[ 'name' => 'An Error Occurred', 'size' => 0, 'error' => 'Il file non può essere elaborato.']]]; |
|
echo json_encode($response); |
|
} |
|
|
|
if (!function_exists("fatal_handler")) { |
|
function fatal_handler() { |
|
$error = error_get_last(); |
|
if( $error !== NULL && $error['type'] === E_ERROR) { |
|
error_respone(); |
|
} |
|
} |
|
} |
|
register_shutdown_function("fatal_handler"); |
|
|
|
$folder = filesManager::tempDirUploadPath(); |
|
$options = array( |
|
'upload_dir' => "{$folder}/", |
|
'upload_url' => "{$folder}/", |
|
'root' => $root, |
|
'access_control_allow_methods' => ['POST'], |
|
'inline_file_types' => filesManager::acceptedFilesExtensions("regex"), |
|
'accept_file_types' => filesManager::acceptedFilesExtensions("regex"), |
|
); |
|
|
|
|
|
foreach ($_FILES as &$file) { |
|
if (!empty($file["name"])) { |
|
$file["name"] = sanitize_string(html_entity_decode($file["name"])); |
|
} |
|
} |
|
if (!is_dir($options['upload_dir'])) { mkdir($options['upload_dir'], 0755, true); } |
|
$upload_handler = new UploadHandler($options); |
|
} |
|
?>
|
|
|