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.
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.
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?
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.