views:

44

answers:

4

What is a good alternative open source library to orielly's MultipartRequest for handling uploaded files?

+3  A: 

The Apache Commons FileUpload has worked for me in the past. I believe it's what the Spring framework uses internally to handle multipart requests.

Kaleb Brasee
+4  A: 

Apache Commons FileUpload has become the defacto standard for this now. It's pretty useful, has lots of options for handling larger uploads, and is used by Spring MVC as the backing implementation for this functionality.

skaffman
+2  A: 

If you've made the leap to Servlet 3.0, you can annotate your servlet to support file upload.

From the spec:

File upload

If a request is of type multipart/form-data and if the servlet handling the request is annotated using the @MultipartConfig as defined in Section 8.1.5, “@MultipartConfig” on page 8-64, the HttpServletRequest can make available the various parts of the multipart request via the following methods

  • public Collection getParts()
  • public Part getPart(String name).
McDowell
See for examples: [Uploading files in Servlet 3.0](http://balusc.blogspot.com/2009/12/uploading-files-in-servlet-30.html). By the way, Glassfish v3 Java EE 6 uses Commons FileUpload behind the scenes for the task. It's indeed the *defacto standard* as @skaffman said.
BalusC
A: 

Is javax.mail.internet.MimeMultipart usable in this context?

simon