getValue() receives the file.
And you add the filter afterwards in your code...

But as the files are already received you can not apply the filters. The files are already there so a later receive would not receive the files again.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "paperogiallo" <[email protected]>
To: <[email protected]>
Sent: Wednesday, December 17, 2008 5:14 PM
Subject: Re: [fw-general] [Zend_Form] Zend_Form_Element_File::getValue() is calling Zend_File_Transfer_Http:: receive()







thomasW wrote:

Hy,
So the logical way in my opinion would be to call getFileName, change the
name according to the primary key of the database by applying the rename
filter, and then, as last step calling getValues().
If validation or anything other fails, revert db entry.
You could even validate before attaching the rename filter because
validation does not receive the file.

if ($file->isValid()) {
    $file->getFileName();
    get id, rework filename
    $file->addFilter('rename', $newfilename);
          ->getValues();
}


If I undestood, this way you can't insert data into db calling
$form->getValue(), like I'm used to do:

if($form->isValid()){
 $id = $this->dbTable->insert($form->getValue());
 $this->getElement('fileUpload')->addFilter('Rename',$id.'.jpg');
}

...meaning getValue() method of Zend_Form is useless for those form using
Zend_Form_Element_File... or had I miss something?

--
View this message in context: http://www.nabble.com/-Zend_Form--Zend_Form_Element_File%3A%3AgetValue%28%29-is-calling-Zend_File_Transfer_Http%3A%3A-receive%28%29-tp20818332p21055532.html Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to