>
> In case the file was already received, the received method returns true and
> not null.
> Only when the upload is not possible due to failed validation it returns
> false, and null by getValues().
>
> The reason is, that when the file is not uploaded (because it's not valid)
> it will of course also not have a value due to being empty.
Thank you for your answer but for me the problem is the concept
he's talking about the $form->getValues() method ...
The getValue() method of a Form_Element_File causes the
receive() method that call the adapter's receive() method to really move the
file from tmp dir as follow:
$adapter = $this->getTransferAdapter();
if ($adapter->receive($this->getName())) {
=>
if (!move_uploaded_file($content['tmp_name'], ($directory . $content['name']))) {
IMHO this approach is too much restrictive 'cause the file is received (so moved
an renamed to original name) during the validation process of a Form or
everytime the $form->getValues() method is called (also for other data)
For my case it's necessary to validate the file when it's still in tmp dir ...
then if all it's ok (size, mime, dim etc) I'll provide to scale it, to make a
thumb copy renaming them from the tmp_name to $id . ".jpg", watermarking etc ...
... or maybe I missunderstood
>
> For the next minor release, the change you mentioned is no longer necessary
> as you can get file informations since several weeks also after the file has
> already been received.
>
good news
bye
Simone
--
________________________________________________________________________________
Simone Cosci - Planet S.r.l. Sistemi informatici
Via Giorgio Ambrosoli, 39 - 50018, Scandicci, Firenze, Italy
WEB: http://www.planetweb.it - http://www.ticka.it
E-Mail s.cosci@nextidea.it
Tel. +39 055 7350271 - Fax. +39 055 7351109
________________________________________________________________________________
没有评论:
发表评论