At 3:01 PM +0800 1/24/05, Nathan Coast wrote:
Hi,

Does the validator support max file size for an uploaded file? I have found various threads covering how to specify the max file size and how to check if it is exceeded but this all seems to be server-side and outside of the validator mechanism
e.g.
http://www.mail-archive.com/user@struts.apache.org/msg12942.html


I'm not even sure if it is possible to find the size of a file upload within javascript. Obviously if it isn't possible from javascript, it can't be implemented in the validator (not in the client at least).

I don't believe there is any standard client-side mechanism for enforcing something like this. Here's an unauthoritative reference:
http://www.cs.tut.fi/~jkorpela/forms/file.html#restr


Interestingly, the original File upload RFC (1867) suggested that the meaning of "maxlength" in a "file" type input element be used as a hint to the maximum acceptable upload size. However, the HTML 4 spec clearly says that in this context, "maxlength" refers to the length of the file path (a silly thing to enforce, since the client-side file path should be immaterial to the server.)

Furthermore, I would think there would be scoping/timing problems, as before the form is submitted, the browser wouldn't want to fool with the file, because it might be lag-inducing, and once the form is submitted, there's no longer a chance for JavaScript to execute.

Seems like a shortcoming of the spec to not permit page authors to specify this in the tag, but it's probably because they didn't want to clutter the <input> element spec with too many modal details. (Although there is the rarely-used "accept" element which is supposed to accept an enumeration of permitted MIME types for the upload.)

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to