This gives you an entire working example (worth 1000 user manual pages) http://www.codejava.net/java-ee/servlet/apache-commons-fileupload-example-with-servlet-and-jsp .... I have tested it and put in https://github.com/vernetto/WebFileUploader (just git clone it and run it).
Here the user guide of Apache FileUpload module:
http://commons.apache.org/proper/commons-fileupload/using.html
Create a webapp
Download commons-io jar http://commons.apache.org/proper/commons-io/download_io.cgi and commons-fileupload jar http://commons.apache.org/proper/commons-fileupload/download_fileupload.cgi and place them in WEB-INF/lib
Well actually rather than putting here snippets of code, here is the whole NON-Streaming example https://github.com/vernetto/WebFileUploader and here the STREAMING example https://github.com/vernetto/WebFileUploaderStreaming
I have tested with a 4GB file and memory occupation on the server (and Garbage Collection) was really minimal... transfer speed was also decent (say 2 minutes for a 4GB file....).
Here https://raw.githubusercontent.com/vernetto/WebFileUploaderStreaming/master/WebFileUploaderStreaming.war you can download the war file directly.
Saturday, October 10, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment