I'm using Zend_File via Zend_Form_Element_File to let my web application's
users upload files. I use the following Validators:
$file1->setRequired(true)
->addValidator('NotEmpty',true)
->addValidator('Count',false,array('min' => 1, 'max' => 1))
->addValidator('MimeType', true, array('application/pdf'))
->addValidator('Extension',false,array('pdf'))
->addValidator('Size',false,array('max' => '6MB'));
It works ok and the validators seem to do their job well but on one
occasion: when the user tries to upload a file that's bigger than what's
allowed in the server's php.ini file. That value is set to 10MB and when I
upload a file of let's say 12MB I just get this error:
Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with message
'"file1" not found by file transfer adapter'.
If the user tries to upload a file that's bigger than 6MB (as defined in the
Size validator) but smaller than 10MB it's ok as a user-friendly message is
shown to the user.
Is there a way to display a user-friendly message to the user when he/she
tries to upload a file bigger than what's allowed in php.ini? Now it just
looks as if the application is broken.
For the record: I have set html's MAX_FILES_SIZE to 6MB as well.
--
View this message in context:
http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p21936346.html
Sent from the Zend Framework mailing list archive at Nabble.com.