What is a开发者_Python百科 good alternative open source library to orielly's MultipartRequest for handling uploaded files?
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.
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.
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).
Is javax.mail.internet.MimeMultipart usable in this context?
精彩评论