Component Overview
\[http://jakarta.apache.org/commons/fileupload Commons-FileUpload\] makes it easy to add robust, high-performance, file upload capability to your servlets and web applications.unmigrated-wiki-markup Wiki Markup
A lot of information is available on the \[http://jakarta.apache.org/commons/fileupload/ FileUpload website\]. If you don't find the information you need you can always contact us using one of the \[http://jakarta.apache.org/site/mail2.html#Commons mailing lists\].
External Resources
If you have a good example, add it here! |
...
Add your questions/answers here. |
Q: When parsing a multipart request that exceeds the maxSize or if a file exceeds the maxFileSize, is there any way to drop the file/files from the parsing process and still return the field items?
I though of putting the field items in the query string but haven't tested it. Even if it would work, it wouldn't be a handsome solution!
Q: I'm using a DiskFileItemFactory from FileUpload 1.2.1. In the Resource Cleanup section of the User Guide, the following code is shown:
return new DiskFileItemFactory(fileCleaningTracker,
DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD,
repository);
This method doesn't actually exist (with the implied signature), so instead, I've done the following:
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setFileCleaningTracker(fileCleaningTracker);
Is this how it should be done now?
Q: I'm using FileUpload 1.1.1,when I use ServletFileUpload.isMultipartContent(request).This is said "Use the method on ServletFileUpload instead".But I can't find "isMultipartContent" method in ServletFileUpload........
...
A: The reason was Internet Explorer needs the following in Apache:
[SetEnvIf] User-Agent ".\*MSIE.\*" \
nokeepalive \ Wiki Markup
nokeepalive ssl-unclean-shutdown \[BR]
\
downgrade-1.0 force-response-1.0
Zsolt
Wiki Markup |
---|
*Q:* I use commons.fileupload to upload a file in my application, but it throws an exception called "NotSerializableException", the server which the application run on is WAS5.1 and struts 1.2.4. Here is the output log: \[06/05/15 19:15:36:873 JST\] 78adaa3 [SessionContex] E 例外: java.io.NotSerializableException: org.apache.commons.fileupload.DeferredFileOutputStream at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code)) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code)) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code)) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Inlined Compiled Code)) at java.util.Hashtable.writeObject(Hashtable.java(Compiled Code)) at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code)) at java.lang.reflect.Method.invoke(Method.java(Compiled Code)) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code)) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code)) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.BackedHashtable.commonSetup(BackedHashtable.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.BackedHashtable.persistSession(BackedHashtable.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.BackedHashtable.ejbStore(BackedHashtable.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.BackedHashtable.storeSession(BackedHashtable.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.BackedHashtable.put(BackedHashtable.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.DatabaseSessionContext.sync(DatabaseSessionContext.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.SessionData.sync(SessionData.java(Inlined Compiled Code)) at com.ibm.ws.webcontainer.httpsession.DatabaseSessionData.sync(DatabaseSessionData.java(Inlined Compiled Code)) at com.ibm.ws.webcontainer.httpsession.DatabaseSessionContext.checkForSessionWrites(DatabaseSessionContext.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.DatabaseSessionContext.asyncExternalWrite(DatabaseSessionContext.java(Compiled Code)) at com.ibm.ws.webcontainer.httpsession.SessionAlarmListener.alarm(SessionAlarmListener.java(Compiled Code)) at com.ibm.ejs.util.am._Alarm.run(_Alarm.java(Compiled Code)) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code)) |
...