commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Latha.Kamat...@cybernetsoft.com
Subject File Upload problem
Date Tue, 19 Jul 2005 05:44:42 GMT
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 only..ie.no 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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message