No, the transfer adapter is only available on the file element. The form can
not handle this.
So the proper call would be:
$form->file1->getTransferAdapter();
But actually all methods which are available in the transfer adapter have
also a proxy in the file element. But this is only true for the latest
release and some in trunk.
And as you noted "several directories"... I did not see that you added any.
Of course, when you use one instance you also use the settings of this
instance.
When you need different locations within the same adapter you should use the
rename filter which also does the renaming of files which you mentioned some
mails ago.
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: Thursday, December 04, 2008 12:37 PM
Subject: [fw-general] Zend_Form::getTransferAdapter()
Hi all, Thomas,
I'm going further in my testing of Zend_Form + Zend_File_Transfert and I
have to say "I'm going too love it", very nice, make things really smooth.
But for now I'm facing an other issue :
Thomas I saw on your blog
(http://www.thomasweidner.com/flatpress/2008/11/01/file-transfer-hashing-and-other-news/)
that you use Zend_Form::getTransferAdapter() but this method is not or not
yet present in Zend_Form (in ZF 1.7.1).
So for now I'm calling getTransferAdapter() from one of the form file
element $this->_form->getElement('file1')->getTransferAdapter()
But now if I have several files to upload with different destination
directories and as each form elements seems to have is own TransferAdapter
this line above is not working as expected :
$uploader = $this->_form->getElement('file1')->getTransferAdapter();
if (! $uploader->receive(array('file1' , 'file2'))) {
throw new Exception("Not able to save the files");
}
file1 is save in the right directory while file2 is save in /temp
directory
If I do $uploader =
$this->_form->getElement('file2')->getTransferAdapter();
file2 is save in the right directory while file1 is save in /temp
directory
It seams that is due to the fact than each form elements have is own
instance of TransferAdapter.
Regards,
--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://laurent.2mx.fr/