• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg. File Upload

 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I upload the file into server using html form multipart encoding, will all the file content will be stored in jvm memory? If I upload 200 mb memory and my jvm is of size 128 mb, how can I upload this file? I am sure that I cannot upload this file. Is it possible to track atleast that my file size is 200mb and cannot handle that and give a message to user? If I give a message to user, can I get my memory back so that I can continue with Normal operations?
Thanks for your help adavnce. I appreciate all replies.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "Reg." in "Reg. File Upload"?


Servlets do not have mulitpart (file uploading) capability by spec.
To enable file uploading, most servlet developers use 3rd party libraries.
How the upload is handled (memory vs disk) depends on the library used and how it is configured.

See: http://faq.javaranch.com/view?FileUpload for links to the more common 3rd party libraries.
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reg. is short form of Regarding. Sorry for confusion.
I understand servletes do not provide framework within itself for upload. I am using file upload feature that comes along Struts.(Not sure whether it is different from Commons project!). It allows to upload files of anysize. But my JVM size is limited to 128 MB. In that case I cannot allow upload more than around 15MB right? It is web application. High chances are there for concurrent users(upto 15). If some user tries uploading file size of 100mb. How can I track this, without getting out of memory exception?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts does use the commons/fileupload libraries.
I know there are some options as to file size, and where & when the upload gets written to disk. I think, by default, files get written to a temp dir.
You would need to check to be sure.
Look in the documentation provided with the libraries.
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben, I will check the documentation.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From:
http://jakarta.apache.org/commons/fileupload/using.html


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic