my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes Reg. File Upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Reg. File Upload" Watch "Reg. File Upload" New topic
Author

Reg. File Upload

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
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.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Sep 02, 2005
Posts: 445
Thanks Ben, I will check the documentation.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

From:
http://jakarta.apache.org/commons/fileupload/using.html


 
Don't get me started about those stupid light bulbs.
 
subject: Reg. File Upload