Zend Framework

Error by Upload

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.7.2
  • Fix Version/s: None
  • Labels:
    None

Description

There is a bug in Zend_Form_Element_File class.

If you are want to upload a file, you get back a error message.
You get it back every time and no upload will be finished.

Here is my code from a form:

$foo = new Zend_Form_Element_File('foo');
$foo->setLabel('Choose a image:')
->setDestination("/var/www/zend_quick/public");
$foo->addValidator('Extension', false, 'jpg,png,gif');

$this->addElement($foo);

from the controller:

if($this->getRequest()->isPost() == true) {

if (!$form->foo->receive()) {
print "error";
}
}

then I get back some error messages.

1.) The file '' was not found
2.) Notice: Undefined index: tmp_name in /usr/share/php/libzend-framework-php/Zend/File/Transfer/Adapter/Abstract.php on line 589
3.)Notice: Undefined index: name in /usr/share/php/libzend-framework-php/Zend/Validate/File/Extension.php on line 228

best regards

anno

Issue Links

Activity

Hide
Thomas Weidner added a comment -

Can not be reproduced.
Feel free to reopen and give a full example.

See the manual and the several examples which are available.

Show
Thomas Weidner added a comment - Can not be reproduced. Feel free to reopen and give a full example. See the manual and the several examples which are available.
Hide
Thomas Weidner added a comment -

PS: This failure comes for example when you forgot to set "multipart/form-data" on the form which means that the form does not support files to be uploaded.

Show
Thomas Weidner added a comment - PS: This failure comes for example when you forgot to set "multipart/form-data" on the form which means that the form does not support files to be uploaded.
Hide
Paul Michael Laborte added a comment -

I got the same <a href="http://dayg.slingandstoneweb.com/2009/02/03/zend-framework-large-file-upload-issues/">Zend File Upload errors</a>.

Apparently, I was uploading a file bigger than the allowable limit set in php.ini. This was fixed by updating post_max_size and upload_max_filesize.

Hope this helps.

Show
Paul Michael Laborte added a comment - I got the same <a href="http://dayg.slingandstoneweb.com/2009/02/03/zend-framework-large-file-upload-issues/">Zend File Upload errors</a>. Apparently, I was uploading a file bigger than the allowable limit set in php.ini. This was fixed by updating post_max_size and upload_max_filesize. Hope this helps.
Hide
Thomas Weidner added a comment -

Not with the actual release.

The configuration settings are checked and integrated into the form as MAX_FILE_SIZE element.
Your browser will then give a failure when the file extends this size.

Show
Thomas Weidner added a comment - Not with the actual release. The configuration settings are checked and integrated into the form as MAX_FILE_SIZE element. Your browser will then give a failure when the file extends this size.
Hide
drm / Gerard added a comment -

This problem occurs when the file pushes the complete POST body above the post_max_size threshold; the entire _POST and _FILES array are both empty. Regular validators will handle this well, the file validators won't since the adapter tries to fetch the file content anyway. This should be checked by the adapter. I haven't had enough time to figure out where exactly this should be fixed, but it really is a pickle.

Show
drm / Gerard added a comment - This problem occurs when the file pushes the complete POST body above the post_max_size threshold; the entire _POST and _FILES array are both empty. Regular validators will handle this well, the file validators won't since the adapter tries to fetch the file content anyway. This should be checked by the adapter. I haven't had enough time to figure out where exactly this should be fixed, but it really is a pickle.
Hide
Thomas Weidner added a comment -

This does not matter... the adapter checks this.
But as said in past you need to use the proper release.

This feature was added somewhere at 1.8.

Look into the Http adapter. When such an error occurs then the content length is 0 (as POST is empty).
So as soon as you try to receive a file, or validate it in such an case, then you will get false in return

Show
Thomas Weidner added a comment - This does not matter... the adapter checks this. But as said in past you need to use the proper release. This feature was added somewhere at 1.8. Look into the Http adapter. When such an error occurs then the content length is 0 (as POST is empty). So as soon as you try to receive a file, or validate it in such an case, then you will get false in return

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: