Posting this one for a friend. They have an Icefaces app that uses Icefaces's inputfile functionality but it attempts to upload the file to a temporary directory before it allows access to it. Long story short, there is no access to the temp location so copying the file (which will enventually end up in a database) is not possible. Is it possible to use a Java Servlet instead to upload the file and stream the contents to where they do have access without first having the file saved to a temporary location?
views:
51answers:
2
+1
Q:
Is there a way to upload a file using a Servlet that allows skipping the save to temporary location?
+2
A:
Yes, that's absolutely possible. The servlet's doPost()
method can do whatever it wants with the input, and is designed for processing it in a streaming manner. However, wiht a bare servlet you'd have to parse the request body manually. Fortunately, Apache Commons FileUpload can do that for you.
Michael Borgwardt
2010-03-22 16:21:03
Thank You, I will give that a shot. I've heard good things about Commons FileUpload as well.
Vinny
2010-03-22 16:34:48
A:
Since it was tagged with iceFaces, I am assuming that's what your friend is using in developing this. If that's the case you can use the inputFile component.
Here is a tutorial on how to do it. You can also specify absolute path. It basically uses Commons File Upload under the hood.
CoolBeans
2010-05-04 15:27:00