Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/xampp/php/tests/parseDir/PHP5/ |
<?php $uploadErrors = array( UPLOAD_ERR_INI_SIZE => "The uploaded file exceeds the upload_max_filesize directive in php.ini.", UPLOAD_ERR_FORM_SIZE => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.", UPLOAD_ERR_PARTIAL => "The uploaded file was only partially uploaded.", UPLOAD_ERR_NO_FILE => "No file was uploaded.", UPLOAD_ERR_NO_TMP_DIR => "Missing a temporary folder.", UPLOAD_ERR_CANT_WRITE => "Failed to write file to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension.", ); $errorCode = $_FILES["myUpload"]["error"]; if ($errorCode !== UPLOAD_ERR_OK) { if (isset($uploadErrors[$errorCode])) { throw new Exception($uploadErrors[$errorCode]); } else { throw new Exception("Unknown error uploading file."); } } ?>