javafile-uploadmultipartform-dataapache-commons-fileupload

Re usable, thread safe cmponents in commons-fileupload


I am using commons-fileupload to read image file from the POST request using classes DiskFileItemFactory and ServletFileUpload.

Can someone help me with which objects off the above can be re-used and accessed concurrently among threads or will have to be created anew for each request

Thanks in advance


Solution

  • Could not get any straight point in this direction. But found the Streaming API of the commons file upload here. Since it creates one ServletFileUpload object, So I think this migh be a better idea.

    // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload();