Laurent,
I would say that the isReceived method is a really easy way to check this.
Or you can get the file infos and check for the isReceived tag manually.
You can delete all files which have been received until then without
problems.
Changing the name can also easily be done by using the rename filter.
When you want to do the retrievment manually you can do this already with
the existing implementation.
Simply use the old syntax instead of the new getValue syntax.
isValid -> rename -> receive
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "Laurent Melmoux" <[EMAIL PROTECTED]>
To: "Zend Framework General" <[email protected]>
Sent: Wednesday, December 03, 2008 7:04 PM
Subject: [fw-general] [Zend_Form] Zend_Form_Element_File::getValue() is
calling Zend_File_Transfer_Http:: receive()
Hi,
I’m wondering if it is a good idea to move the uploaded file on
Zend_Form_Element_File::getValue() call.
Because:
• If the receive() failed for what ever reason I may not want to go
further like inserting the other data in the database. And Currently there
is no easy way to check if receive() succeed.
• Or if a database transaction failed I will have to delete the files
• What if we want to name the file from the UID of the database record
Personally I prefer to use this pattern:
$this->db->beginTransaction();
try {
// will not call receive()
$data = $this->form->getValues(); $this->insert($data);
// will call Zend_File_Transfer_Http:: receive()
// if receive() failed throw an exception then no data is inserted
$this->saveFiles();
$this->db->commit();
} catch (Exception $ex) {
$this->db->rollBack();
}
Not calling receive() on Zend_Form_Element_File::getValue() would leave
more flexibility for the developer on how he want to handle the file. What
do you think?
--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://laurent.2mx.fr/