|
I'm trying to use FileUpload 1.0 for the first time but I'm finding the
documentation confusing. I'm referring to the "Using" document at http://jakarta.apache.org/commons/fileupload/using.html.
According to this document, the first line I need after verifying that the
input is multipart is:
FileUpload upload = new DiskFileUpload();
However, when I code this line, my compiler (Eclipse 2.1 RC) says:
Type mismatch - cannot convert from FileUpload to DiskFileUpload.
When I check the API, it confirms that both FileUpload and DiskFileUpload
are subclasses of FileUploadBase and are therefore siblings, not subclasses of
one another.
If I change the code to say:
DiskFileUpload upload = new DiskFileUpload();
the code compiles fine.
However, a few lines later, in the while() loop that processes the items
that are being uploaded, this line crashes at execution on a
ClassCastException:
FileItem item = (FileItem) iter.next();
Will someone please tell me what's going on? I'm writing the code exactly
as described in the "Using" document but it doesn't work. This appears to be the
only documentation aside from the API but I never find APIs very useful for
learning how to do something for the first time, just for checking details of
what methods and fields are available.
I'm running FileUpload 1.0, Full Release. My OS is Windows XP Pro. I'm
using Tomcat 4.1.24 and Eclipse 2.1 (RC1).
Rhino --- rhino1 AT sympatico DOT ca "If you want the best seat in the house, you'll have to move the cat." |
- Re: FileUpload documentation confusing Rhino
- Re: FileUpload documentation confu... Will Stranathan
- Re: FileUpload documentation c... Rhino
- RE: FileUpload documentati... Bill Comer
- Re: FileUpload documentation confu... Will Stranathan
- Re: FileUpload documentation c... Rhino
- Re: FileUpload documentati... José Antonio Pérez Testa
