commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Cook <>
Subject Re: [FileUpload] ] File Upload problem
Date Tue, 19 Jul 2005 17:49:54 GMT

Ok if the iterator is returning zero items that means that either the 
HttpServletRequest object was empty, or that for some reason that type 
was not set to "multipart/form-data".

Are you using the .isMultipartContent(HttpServletRequest req) method to 
test the HttpServletRequest to make sure that it is "multipart/form-data"?

If so you may want to check the HttpServletRequest object as soon as it 
comes in to see if the fields you are posting are in it.  If they are 
not there is probably a syntax problem with the form and or field tags.

P.S.  You may want to review the guide lines for posting to this list. 
It will help you get more responses if you follow those recomendations. wrote:
> Hi experts
> In my application, I use commons-fileupload-1.0.jar for file upload.
> In the Jsp page, 
> I use the <html:form action="EventDetailsForScheduler" 
> enctype="multipart/form-data" method="POST">.
> and a file for field 
> <html:file name="eventdetailsform" property="imageFile" size="40"/>
> In the Formbean class I have a property imageFile of Type FormFile to 
> capture this value.
> I want the Action class to do the file uploading( I use the builtin 
> ActionServlet only...No customized Servlet or anything..)
> In the execute Method,
> I use the following code
>                 DiskFileUpload fu = new DiskFileUpload();
>                 // If file size exceeds, a FileUploadException will be 
> thrown
>                 fu.setSizeMax(1000000);
>                 List fileItems = fu.parseRequest(req);
>                 Iterator itr = fileItems.iterator();
> But the size() method of this Iterator returns zero file is 
> sent for uploading..
> I tried printing the file name in the
> setImageFile() method of the bean.and is correctly printing.then why it is 
> not retrived in the Action class?
> Cannot I handle the fileuploading inside the Action class?
> What cud be wrong?
> Thanks in advance
> Aathi

Brian Cook
Digital Services Analyst
Print Time Inc.

View raw message