note 38683 rejected from features.file-upload by nlopess

From: Date: Fri, 02 Jan 2004 20:07:39 +0000
Subject: note 38683 rejected from features.file-upload by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62808@lists.php.net to get a copy of this message
Note Submitter: richard@phpyellow.com ---- Ever wonder what the error is? Here's code to display the image upload error code and text: <?php if (version_compare( phpversion(), "4.2.0") > 0) { // this reporting available 4.2.0 or higher only // give full reporting about file upload, regardless of result echo "<h2>Internal PHP Report about file upload</h2>"; $upload_error_no = $_FILES['userfile']['error']; switch($upload_error_no) { case 0: echo "<h4>UPLOAD_ERR_OK</h4>"; echo "upload error # $upload_error_no<br> There is no error, the file uploaded with success."; break; case 1: echo "<h4>UPLOAD_ERR_INI_SIZE</h4>"; echo "upload error # 1<br> The uploaded file exceeds the upload_max_filesize directive in php.ini."; break; case 2: echo "<h4>UPLOAD_ERR_FORM_SIZE</h4>"; echo "upload error # 2<br> The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form."; break; case 3: echo "<h4>UPLOAD_ERR_PARTIAL</h4>"; echo "upload error # 3<br> The uploaded file was only partially uploaded."; break; case 4: echo "<h4>UPLOAD_ERR_NO_FILE</h4>"; echo "upload error # 4<br> No file was uploaded."; break; default: echo "Out of range upload error number of &quot;$upload_error_no&quot; for switch(upload_error_no)"; } } ?>

« previous php.notes (#62808) next »