commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <>
Subject FileUpload documentation confusing
Date Tue, 01 Jul 2003 12:30:57 GMT
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

According to this document, the first line I need after verifying that the input is multipart

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);

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). 

rhino1 AT sympatico DOT ca
"If you want the best seat in the house, you'll have to move the cat."
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message