Hi Thomas,
Well I said $_FILES to simplified the internal of
Zend_File_Transfer_Adapter_Abstract which is using
Zend_File_Transfer_Adapter_Abstract ::_files :) sorry if it made it
confusing.
To simplified it :
If I call Zend_Form::getValues() before any form submission an exception
is thrown ("myFile" not found by file transfer adapter ) which occur in
Zend_File_Transfer_Adapter_Abstract :: _getFiles() because it can not
find the element in _files
Right now I’m using the patch below (which is making use of the
$noexception arg to avoid the exception) and it is working ok:
Zend_Form_Element_File::getValue()
// @line 643
$content =
current($this->getTransferAdapter()->getFileInfo($this->getName(), true));
And
Zend_File_Transfer_Adapter_Abstract
// @line 886
public function getFileInfo($file = null, $noexception = false)
{
return $this->_getFiles($file, false, $noexception);
}
Thomas Weidner a écrit :
Laurent,
getValues does NOT access $_FILES.
This you have misunderstood. The $_FILES array is used as input for
the transfer adapter. But again, it does not work with the $_FILES
array. The internal representation of the data is different to $_FILES.
So you said that you are not displaying the form but do this yourself.
As long as you are following the syntax of the HTTP file element it
should work.
But when you use subforms or multifiles and are not using the file
decorator you must do the normalisation manually.
This exception you are referring to does simply say:
The file element you requested is not defined, nor is it a filename or
a temporary name... I don't know which data you want to work with.
As you gave no details it's hard to say something specific to this
problem.
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 3:01 PM
Subject: [fw-general] Zend_Form + Zend_File_Transfer issue with
Zend_Form::getValues()
Hi guys, Matthew, Thomas,
I’m giving a try to Zend_Form + Zend_File_Transfer and I’m facing a
issue with Zend_Form_Element_File::getValue()
I’m not using Zend_Form to renders my forms.
Before displaying the form (on create or update) I populate it with
default values or values from the db and then I’m using
Zend_Form::getValues() to pass form values to the view.
But here with files element Zend_Form_Element_File::getValue() try to
access the global $_FILES and as no form has been submitted yet an
exception thrown :
throw new Zend_File_Transfer_Exception(sprintf('"%s" not found by
file transfer adapter', $find));
See :
Zend_File_Transfer_Adapter_Abstract ::getFileInfo($file = null)
Zend_File_Transfer_Adapter_Abstract ::_getFiles($files, $names =
false, $noexception = false)
Is it a issue or am I using incorrectly Zend_Form + Zend_File_Transfer ?
Regards,
--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://laurent.2mx.fr/
--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://laurent.2mx.fr/
Tél. | +33 (0)9 74 53 10 40