Zend Framework

Zend_File_Transfer_Adapter_Abstract does not handle file uploads when no file is uploaded

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Not an Issue
  • Affects Version/s: 1.7.2
  • Fix Version/s: None
  • Component/s: Zend_File_Transfer
  • Labels:
    None

Description

Zend_File_Transfer_Adapter_Abstract does not handle file uploads when no file is uploaded by the user.

Example code

$f = new Zend_Form();
$f->addElement('file', 'photo', array(
	'label' => 'photo',
	'required'=> false
))
  ->addElement('submit', 'save', array('label' => 'btn_save'));

if($_POST && $f->isValid($_POST)) {
  echo 'valid';
}

echo $f->render(new Zend_View());

Exception is thrown when form is submitted: "photo" not found by file transfer adapter
The problem is on line 572, Zend/File/Transfer/Adapter/Abstract.php, where validation does not consider option ignoreNoFile for the adapter.

Issue Links

Activity

Hide
michal kralik added a comment -

I forgot the 'multipart/form-data' encoding, my bet, can be closed

Show
michal kralik added a comment - I forgot the 'multipart/form-data' encoding, my bet, can be closed

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: