var_dump($this->getForm()->image->receive())) returns bool(false) - however,
the file is uploaded just fine, it appears in the destination directory
without any issues. also, calling $this->getForm()->image->isReceived()
after calling receive() returns true!

so in reference to your suggestion below, are there any methods for
retrieving the actual error that caused receive() to return false? all i can
seem to get out of it is a boolean.

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

> getValue() returns null when there is any error.
> So the question is which error is returned.
>
> When you say that isValid() returns not false, then the question is why
> receive() returns false. Look at it's error message to see details.
>
>
> 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 10:22 AM
>
> Subject: Re: [fw-general] File Element problem - getValue() returns null,
> but getFileName() returns full path and file?
>
>
>  oops - to clarify, if you var_dump on $values, $values['image'] is null,
>> the
>> rest of the array is fine, and what you would expect.
>>
>> On Thu, Feb 11, 2010 at 5:19 PM, Cameron <themsel...@gmail.com> wrote:
>>
>>  I'm trying to get the filename. If you var_dump on $values below, it is
>>> null. I'm only using the second call to getValue() to show how it isn't
>>> working. I believe the standard mode of operation is to go like this:
>>>
>>> if (! $this->getForm()->isValid ( $data )) {
>>>     return false;
>>> }
>>>
>>> $values = $this->getForm()->getValues();
>>>
>>> return $this->getTable()->insert ( $values );
>>>
>>> Which is exactly what I've got. But it isn't working.
>>>
>>> On Thu, Feb 11, 2010 at 5:07 PM, Thomas Weidner <thomas.weid...@gmx.at
>>> >wrote:
>>>
>>>  Question:
>>>>
>>>> You have already received the file by calling getValues() on the form.
>>>> Why do you want to receive the file once again?
>>>>
>>>> A received file can not be received once again (not with 1.9.5).
>>>>
>>>>
>>>> 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 9:40 AM
>>>> Subject: Re: [fw-general] File Element problem - getValue() returns
>>>> null,
>>>> but getFileName() returns full path and file?
>>>>
>>>>
>>>>
>>>>  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