I hadn't ever turned on ValueDisabled, but even so I just set it to false,
$element->setValueDisabled(false). And the code comes directly after an
isValid. In its original context...

if (!$this->getForm()->isValid ( $data )) {
      throw new Exception ( 'Form data invalid!' );
}

$values = $this->getForm()->getValues();
var_dump($this->getForm()->image->getValue());
var_dump($this->getForm()->image->getFileName());

$data is just post data.

On Thu, Feb 11, 2010 at 4:08 PM, Thomas Weidner <thomas.weid...@gmx.at>wrote:

> Look if the value is disabled (isValueDisabled()).
> Per default is could be disabled for security reasons.
>
> And getValue() returns null when there is any error at validation or
> filtering on that file element. Therefor use always isValid().
>
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "Cameron" <themsel...@gmail.com>
> To: "Zend Framework - General" <fw-general@lists.zend.com>
> Sent: Thursday, February 11, 2010 4:48 AM
> Subject: [fw-general] File Element problem - getValue() returns null, but
> getFileName() returns full path and file?
>
>
>
>  The subject says it all - I'm not really sure what I'm doing wrong, but
>> this
>> is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3 btw...
>>
>> I have a basic file field in my form, and it all works perfectly well -
>> calling getValues() on the form moves the file in to the correct location,
>> the whole thing is bulletproof - except that the return of getValues() for
>> the file field is null. Example.
>>
>> $values = $this->getForm()->getValues();
>> var_dump($this->getForm()->image->getValue());
>> var_dump($this->getForm()->image->getFileName());
>>
>> Returns...
>>
>> NULL
>> string(91) "C:\Program
>>
>> Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg"
>>
>>
>> Can anyone help shed some light on this? It's quite peculiar. Obviously
>> I'd
>> like to just automatically pass the $values array through to my add/update
>> method and store the filename in the DB, as I'm sure this whole thing was
>> designed to be used, but I can't seem to get it to work!
>>
>>
>

Reply via email to