Can anyone here kindly let me know the maximum size of a file that could be uploaded through IE using Struts? I have a requirement to upload text files of more than 100MB in Java. Is this possible? Is the maximum size configurable? Any help/links for the same would be appreciated.
Neither the Struts upload feature nor IE impose any upper limits on what size file can be uploaded. You can impose such a limit in your code, however.
For examples, the best place to go is the sample code that comes with the Struts download. You will find sample code there that does a file upload with an imposed size limit. If you're using Struts 1.3.5, the name of the sample application file is struts-examples-1.3.5.war.
Thanks for the quick reply. But i have not imposed any restriction anywhere in the code. Does it mean that i can even upload text files of size more than 200MB (thats my requirement) in my Struts/IE application? My code works perfect for file sizes upto 40MB. After that it fails to deliver. Any idea what could be wrong. Thanks in advance.
Joined: Feb 15, 2005
I'd spend some time looking at the sample code. I'd also try deploying the sample code and using it to upload a large file. That will give you some indication as to whether there is something wrong with your code.
One other point: If you try to read the whole file into memory, then the size of the file you can upload will be limited by the amount of memory allocated to the JVM. Make sure you're adopting a strategy of reading a portion of the input stream, and the writing to the output stream immmediately and then getting the next portion of the input stream. [ March 05, 2007: Message edited by: Merrill Higginson ]
Joined: Aug 10, 2006
Thanks once again, Merrill. FYI, the code that i am using to write the file is: