I can not speak for Zend_Form, but the file component itself, which has
nothing to do with Zend_Form, moves a file if all validators attached to
this file are ok. Zend_File_Transfer can not know about other validators
from other components.
Also, when a user submits a form also attached files are uploaded. This is
due to the HTTP protocol, where files are included in the form itself. There
is no way of seperating them without seperating the data form and the upload
form.
Normally I would propose to do all validations before and at last the file
validations. Maybe you can arrange your validations.
Second, the actual implementation of Zend_File_Transfer is not finished. It
is the smallest summary of features we were able to deliver with 1.6 in this
short time. It is far away from being finished, and you will see that there
are several improvements already in the queue.
To the manual: Filtering IS supported, but there are no filters available at
the moment. In the next few weeks they will be available in the trunk. For
example is there already a imagetype and a mimetype validator available in
trunk which are not delivered with 1.6 due to feature freeze.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "Adam Jensen" <jazzslider@gmail.com>
To: <fw-mvc@lists.zend.com>
Sent: Monday, August 25, 2008 6:50 PM
Subject: [fw-mvc] Zend_Form_Element_File upload issues
> 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
>
没有评论:
发表评论