• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File Upload in IE / Struts

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

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.

Thanks,
Chandrakant
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Chandrakant Nambiar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Chandrakant Nambiar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks once again, Merrill.
FYI, the code that i am using to write the file is:

BufferedOutputStream outStream =
new BufferedOutputStream(new FileOutputStream(savedFile),
40048);
int count;
byte[] databuff = new byte[40048];

while ((count = inStream.read(databuff, 0, 40048)) != -1) {
outStream.write(databuff, 0, count);
}

outStream.flush();
outStream.close();
inStream.close();

Any suggestions to improve this? Thanks.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

I have closed all your other posts in this matter.
 
Chandrakant Nambiar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My apologies for any inconvenience caused to ranchers for the same.
 
reply
    Bookmark Topic Watch Topic
  • New Topic