1

I have created an upload form in Zend which is combined with uploadify to upload multiple files.

The error I keep getting is;

File 'files' exceeds the defined ini size

I have found online that the cause of this error is due to the form not having the enctype set. I have already set it to be

enctype="multipart/form-data"

but I still get the error. The strangest part is that I still get the error even if I have not selected a file to upload?

any ideas?

jjmu15
  • 98
  • 8

2 Answers2

0

I get same error when uploading files using jQuery Form Plugin (http://jquery.malsup.com/form/) and no file is selected. I had to disable validation for this element.

Andrey Ovcharov
  • 299
  • 2
  • 12
0

Simple ajax call will not allow you to send files to server no matter if form enctype is multipart. Had similar issue for couple days and been trying to look for an answer. Came up with jQuery Form Plugin as Andrey Ovcharov mentioned. But still during validation it failed. The trick is to add couple additional options to ajaxSubmit method:

, iframe:true
, url:your_ajax_url

Also, if you want file elements to be optional - make sure your elements are optional. When using multiple files, during submission prepare form to be ready to validate by looping those items and checking if $element->getFileName() is valid string (keeping it simple len > 0 and sometimes check for not being array). I also left $element->setAllowEmpty(true); while testing it. Not sure if very important, but when finally got it working - left, can't do any harm :)

P.S. I know, question is 2012y, but I myself was struggling with zend form validation with optional file uploads + ajax call

donatas M
  • 703
  • 7
  • 8