commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject [FileUpload] Handling File Size Error
Date Tue, 29 Jul 2003 14:59:19 GMT
Can anyone tells me how to modify my file upload servlets to ensure that the contents of an
<input type="file"> control are still present when I return to the form?

I have two servlets: FileUploadFormServlet displays the form and FileUploadHandlerServlet
edits the input, displays error messages if there are any errors and stores the input if there
are no errors.

These two servlets are now working pretty well now except for one thing. I am doing edits
on each of the files which are to be uploaded, including a check to see if the file is larger
than an individual size threshold I have set. (This is something I've created myself because
I want an individual size limit, not the aggregate limit provided by the Commons FileUpload
team.) When an individual file size is too large, I create a message and display it, then
invite my user to press the back button on their browser to go back to the form to modify
the form - either replace the name of the overly large file with a smaller file or blank it
out altogether.

Everything works fine except that when the user gets back to the form, all of the fields that
are <input type=file> are blank. The <input type=text> fields retain their original
values. I would like the <input type=file> controls to also contain their original value.
What do I need to do to make that happen?

I've never seen this "blanking" behaviour in other forms but this is the first time I've written
a servlet containing an <input type=file> control....

I am running Tomcat 4.1.24. My browser is IE 6.0.2800.xpsp2.030422-1633. My OS is Windows
XP Pro with all critical service applied.

Rhino
---
rhino1 AT sympatico DOT ca
"If you want the best seat in the house, you'll have to move the cat."
Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message