1.The file is only uploaded when the form validation passes, not the element
itself
2. A stated here,
http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.file,
the rename filter will be added in future versions. However, you can still
change the file name manually after the file upload using php function
rename.
Regards,
Adam Jensen-2 wrote:
>
> Hello!
>
> Just started using Zend_Form_Element_File on one of my file upload forms,
> and I noticed a couple of things that concern me a bit. (I apologize if
> these have already been mentioned; I couldn't find them in the bug
> tracker,
> but I figured I'd ask here first.)
>
> There does not seem to be any way to keep the file element from moving the
> uploaded file to its target destination in the event of certain kinds of
> errors. There are two error situations I'm most concerned with:
>
> (1) Suppose that the file element isValid(), but the other elements in the
> form are not. The file still gets uploaded to the server, correct? To
> me,
> this doesn't seem like a good idea. Consider a form which corresponds to
> a
> record in a database table. If the user submits the form and three values
> are valid while the remaining six are not, typically we don't write
> anything
> at all to the database (not even the valid values). Now, what if one of
> those valid elements is a file instead? Personally I think the file
> should
> not be uploaded, since none of the other valid values get stored either.
>
> (2) What happens when someone uploads a file that results in a name
> conflict
> in the destination folder? For instance, if my destination folder already
> contains a file called "my_upload.txt" and a user uploads another file
> called "my_upload.txt", currently the existing file simply gets
> overwritten. Is there a way to keep this from happening? Seems like it
> could be built into either a validator or a filter; the validator would
> simply block conflicting files from upload, while the filter would somehow
> change the name of the new file so that it no longer conflicted (of
> course,
> according to the manual, this kind of filtering is not yet supported,
> right?)
>
> Just thought I'd mention these things...what does everyone else think?
>
> Thanks!
> Adam
>
>
--
View this message in context: http://www.nabble.com/Zend_Form_Element_File-upload-issues-tp19147483p19148246.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论