2009年3月30日星期一

Re: [fw-mvc] form->getValues and file upload

> mmm .. IMHO $form->getValues() simply do not have to move files
> and not even filter them in terms of renaming/scaling/watermarking etc ...
> just validate them only for MaxFileSize, Count, MimeType, Extension ..
> that's all
>
> .. it's only my point of view ;)

You still miss one thing...
The value of the form file elment is the file itself.

So when you want to have the value of the file element you want to have the
file itself.
This means that when you call getValues(), the file will be received
otherwise you won't get the file.

When you don't want to get the file (as you said before) you must not call
getValues() on the file element.
Simple as is.

But what you are doing is, "get me the file" and then you you shout "I
didn't want to have the file"...
This does not work... eighter you want the file, or you don't want it.

You have do decide which way/solution you want.

When the two ways I showed you do not confirm your needs, then you will have
to do something your own.
Whatever solution you will create... at end you will still have one of the 2
solutions I wrote...
Eighter get the ID before renaming the file, or rename the file after you
received the ID.
( technical details in the solution not included :-) )

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

没有评论: