Re: uploading 'large' files (e.g. 6MB) -> tmp_name is empty?..
| From: | Greg Donald | Date: | Wed, 01 Dec 2004 20:38:10 +0000 |
| Subject: | Re: uploading 'large' files (e.g. 6MB) -> tmp_name is empty?.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203262@lists.php.net to get a copy of this message | ||
On Wed, 1 Dec 2004 12:32:07 -0800 (PST), Richard Lynch <ceo@l-i-e.com> wrote:
> Note that you also get slightly/subtly different results between:
>
> Successful file upload.
> File too large (or too many) from php.ini settings.
> User canceled upload.
> User did not fill in upload box before submission.
>
> I forget the exact differences
Here's a snippet of code I have to handle the errors you get back:
switch($_FILES['newImage']['error']){
case 0:
$submitSuccess = true;
break;
case 1:
$submitError = true;
$sizeError = 'Image exceeds the php.ini maximum size of ' .
ini_get('upload_max_filesize') . '<br />';
break;
case 2:
$submitError = true;
$sizeError = 'Image must be ' . IMAGE_MAX_IMAGE_SIZE . ' bytes or
less<br />';
break;
case 3:
$submitError = true;
$uploadError = 'The uploaded file was only partially uploaded<br />';
case 4:
$submitError = true;
$uploadError = 'No file was uploaded<br />';
}
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/