Apache Commons File Upload in Struts Dispatch Action class (returnsfileItems 0)

S

sudpri02

Hi,
I am using the following form/Struts 1.1 Action class for File Upload
and I am getting the fileitems as 0. Using Apache Commons File Upload
to parse the request in the Dispatch Action.


JSP:
<form name="merlinUpdatePkgForm" action="/admin/Pkg.do?
method=fileupload" method="post" enctype="multipart/form-data">
<input type="file" name="postalTablePath">
<input type=submit value="Submit">
</form>



Struts action Action class:
---------------------------

public class MerlinUpdPkgCommon extends DispatchAction
{



public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception
{

DiskFileUpload fu = new DiskFileUpload();
List fileItems = = fu.parseRequest(request);
logger.info("fileItems"+fileItems.size());
Iterator itr = fileItems.iterator();

}


}


Any help is appreciated.

regards
sudha
 
D

donghongwu1985

Hi,
I am using the following form/Struts 1.1 Action class for File Upload
and I am getting the fileitems as 0. Using Apache Commons File Upload
to parse the request in the Dispatch Action.

JSP:
<form name="merlinUpdatePkgForm" action="/admin/Pkg.do?
method=fileupload" method="post" enctype="multipart/form-data">
<input type="file" name="postalTablePath">
<input type=submit value="Submit">
</form>

Struts action Action class:
---------------------------

public class MerlinUpdPkgCommon extends DispatchAction
{

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception
{

DiskFileUpload fu = new DiskFileUpload();
List fileItems = = fu.parseRequest(request);
logger.info("fileItems"+fileItems.size());
Iterator itr = fileItems.iterator();

}
}

Any help is appreciated.

regards
sudha

Hi,I had the same problemn,I think you should try Action.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top