commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul J DeCoursey <p...@decoursey.net>
Subject Re: adding patch to jar
Date Thu, 25 Jan 2007 20:15:23 GMT
badi malik wrote:
>> How are you handling the request? I don't think the request object will have a parameter
named filedata. 
>>     
>
> like thus...
>
>             fileItems = servletFileUpload.parseRequest(pageContext.getRequest());
>
> i'm using the pageContext to get the request in this sample because i pulled my code
out of the servlet i was using originally just to see if that was part of the problem and
put it in a scriplet...either way, there are no parameters in the request...i used the Enumeration
object to verify this...
>   
There will be no parameters on the request object because it does not 
find any in a multipart request. You need to iterate over the fileItems 
list to find your files.

Example:

// Process the uploaded items
Iterator iter = fileItems.iterator();
while (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();

    if (item.isFormField()) {
        processFormField(item);
    } else {
        processUploadedFile(item);
    }
}

Hope this helps.

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