ZF-11485: Zend_Form_Element_File validation failure on Iphone/Ipad

Issue Type: Bug Created: 2011-06-16T13:11:16.000+0000 Last Updated: 2012-05-24T15:59:45.000+0000 Status: Resolved Fix version(s): Reporter: coolmic (coolmic) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

  • Zend_Form
  • Zend_Validate_File

Related issues: Attachments:


(Sorry for my english)

On Iphone and Ipad, are not displayed by the browser!

If I want to validate a form, with a not required file element within,

I expect a successful validation, although the file element value is empty But the validation failed with the message : "File 'myfile' exceeds the defined ini size".

If I validate this form with an Iphone/Ipad, in PHP, the global var $_FILES will be an empty array, but the Zend_Validate_File_Upload validator, used by Zend_File_Transfert_Adapter_Http, will detect this as a oversized file upload failure.

To reproduce this error on firefox, we can create a simple form

=== $form = new Zend_Form(); $form->addElement('File', 'myfile'); $form->addElement('Submit', 'submit'); $form->setEnctype(Zend_Form::ENCTYPE_MULTIPART);


and use firebug to delete the element. And submit the form.

The target url must try to validate the form :

if($form->isValid($_POST)) { echo 'ok'; // Processing and exit } var_dump($form->getMessages());


Posted by H Hatfield (hhatfield) on 2011-06-16T17:58:44.000+0000

One thing you can do in ZF >= 1.11 is use Zend_Http_UserAgent and check to see if the client supports xhtml_file_upload (which none of the iOS devices do, currently).

Check out the docs online for how to set it up:…

Posted by Thomas Weidner (thomas) on 2011-06-26T12:30:17.000+0000

Actually there is no way for Zend_File or Zend_Form to recognise if the attached agent supports file uploads or not

I see no way how an solution to this problem could be done when an i* agent behaves like an oversized upload

Feel free to reopen as soon as there is an solution on how this could be recognised

Posted by Martin Panel (xorax) on 2012-05-24T15:59:45.000+0000

This issue is very bad...

Even the file element has setRequired(false), the form is not validated...

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.