note 80130 deleted from features.file-upload.errors by danbrown
| From: | danbrown@php.net | Date: | Mon, 27 Apr 2009 14:38:53 +0000 |
| Subject: | note 80130 deleted from features.file-upload.errors by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153823@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
<?php
$uploadErrors = array(
UPLOAD_ERR_OK => 'There is no error, the file uploaded with success.',
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 && isset($uploadErrors[$errorCode]))
{
throw new Exception($uploadErrors[$errorCode]);
}
?>