commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Antonio Pérez Testa <japte...@indra.es>
Subject Re: FileUpload documentation confusing
Date Tue, 01 Jul 2003 16:31:22 GMT
Maybe the FileItem your compiler is picking up is not the same as the 
one from FileUpload.
Check your CLASSPATH.


Rhino wrote:

>Agreed, I should not have needed to replace the line in the "Using"
>documentation with
>
>DefaultFileItem item = (DefaultFileItem) iter.next();
>
>That was simply an experiment to see if I could coax it to work. According
>to the Eclipse Debugger, items = upload.ParseRequest(request) is returning
>an ArrayList and each of the four elements in that ArrayList are of class
>DefaultFileItem. I've inspected each of the four items and they all look
>reasonable to me. I'm not actually entirely sure what they SHOULD look like
>but my input form has one text field where a user is supposed to supply his
>name, followed by three type="file" inputs. The text field contains a value
>and the first of the file inputs contains a value and the remaining two file
>inputs are empty, exactly as they should be because that's what I put into
>the form. The ENCTYPE in the input form is "multipart/form-data\".
>
>The ClassCastException definitely occurs on this line:
>
>FileItem item = (FileItem) iter.next();
>
>I've verified that in the Tomcat error page and via the debugger.
>
>Any ideas why this code is failing?
>
>Rhino
>
>----- Original Message ----- 
>From: "Will Stranathan" <wstranathan@hotmail.com>
>To: <commons-user@jakarta.apache.org>
>Sent: Tuesday, July 01, 2003 11:38 AM
>Subject: Re: FileUpload documentation confusing
>
>
>  
>
>>DefaultFileItem implements the FileItem interface, so you should not need
>>    
>>
>to
>  
>
>>change that.  Not sure why you're getting a ClassCastException if you know
>>for sure they're DefaultFileItems.  Are you positive the Exception occurs
>>when trying to cast the Object returned from iter.netx() to a FileItem?
>>
>>Will
>>
>>
>>    
>>
>>>From: "Rhino" <rhino1@sympatico.ca>
>>>Reply-To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>>>To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>>>Subject: Re: FileUpload documentation confusing
>>>Date: Tue, 1 Jul 2003 11:28:32 -0400
>>>
>>>Thanks, I already figured that part out ;-)
>>>
>>>Can you tell me what I need to do to get the loop working? I get a
>>>ClassCastException when I execute the line:
>>>
>>>FileItem item = (FileItem) iter.next();
>>>
>>>I watched it in the Eclipse debugger and saw that the items in the
>>>      
>>>
>iterator
>  
>
>>>were DefaultFileItems so I changed the above line to say:
>>>
>>>DefaultFileItem item = (DefaultFileItem) iter.next();
>>>
>>>but this also gave me a ClassCastException. What can I do to resolve this
>>>problem?
>>>
>>>Rhino
>>>
>>>----- Original Message -----
>>>From: "Will Stranathan" <wstranathan@hotmail.com>
>>>To: <commons-user@jakarta.apache.org>
>>>Sent: Tuesday, July 01, 2003 10:50 AM
>>>Subject: Re: FileUpload documentation confusing
>>>
>>>
>>>      
>>>
>>>>A patch was submitted yesterday to update the documentation.  That
>>>>        
>>>>
>>>should
>>>      
>>>
>>>>be:
>>>>
>>>>DiskFileUpload upload = new DiskFileUpload();
>>>>
>>>>Regards,
>>>>Will
>>>>
>>>>
>>>>        
>>>>
>>>>>From: "Rhino" <rhino1@sympatico.ca>
>>>>>Reply-To: "Jakarta Commons Users List"
>>>>>          
>>>>>
>>><commons-user@jakarta.apache.org>
>>>      
>>>
>>>>>To: "commons-user" <commons-user@jakarta.apache.org>
>>>>>Subject: FileUpload documentation confusing
>>>>>Date: Tue, 1 Jul 2003 08:30:57 -0400
>>>>>
>>>>>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();
>>>>>
>>>>>          
>>>>>
>>>>_________________________________________________________________
>>>>The new MSN 8: smart spam protection and 2 months FREE*
>>>>http://join.msn.com/?page=features/junkmail
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>      
>>>
>>_________________________________________________________________
>>STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
>>http://join.msn.com/?page=features/junkmail
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>  
>


Mime
View raw message