commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Sangster" <>
Subject RE: Urgent Help In File Upload
Date Wed, 25 May 2005 22:05:35 GMT
Try putting this

FileUpload.isMultipartContent( request )

in and see if you are getting multipart content.  It returns boolean, and if
true then the parseRequest method of DiskFileUpload will need to be used,
otherwise you can just use the regular getParameters or whatever method from
the servlet/jsp classes to get the parameters (as if a GET was received).


-----Original Message-----
From: Ritesh Koickel [] 
Sent: Wednesday, May 25, 2005 2:14 PM
Subject: Urgent Help In File Upload



I have a JSP page through which I am calling action class we are using
commons.upload.jar. Iam getting List Empty.


sending the sample code for your ready reference.


JSP Page


<html:form method="post" action="/upload" enctype="multipart/form-data"
scope="session" type="com.myapp.form.MyRequestForm">
<html:file property="myRequestFile"></html:file>

<html:text property ="name">
<html:submit value="Import" ></html:submit>



Action Class :- 


DiskFileUpload upload = new DiskFileUpload(); 

List items = upload.parseRequest(request);


Iterator iter = items.iterator();

FileItem item =null;

while (iter.hasNext()) {

                  item = (FileItem);      

                  if (item.isFormField()) {

                        //here i will be getting the file path 

                         String name = item.getFieldName();

                         String value = item.getString();



            byte [] fileData =item.get();



Note :- Iam getting the List as empty, can you please suggest the
alternative , I have even tried using common.upload1.1jar.



DiskFileItemFactory factory = new DiskFileItemFactory(); 

ServletFileUpload upload = new ServletFileUpload(factory); 


List fileItems = upload.parseRequest(req);



This message contains information from Silicon Valley Bank, or from one of
its affiliates, that may be confidential and privileged.  If you are not an
intended recipient, please refrain from any disclosure, copying,
distribution or use of this information and note that such actions are
prohibited.  If you have received this transmission in error, please notify
the sender immediately by telephone or by replying to this transmission.  

This message may include indicative rate information relating to one or more
products offered through Silicon Valley Bank, or affiliated broker-dealer,
SVB Securities. Rates and yields shown are provided for informational
purposes only, are not guaranteed, and are subject to market conditions and
availability.  Nothing in this communication shall constitute a solicitation
or recommendation to buy or sell a particular security. Nations Cash
Reserves, Nations Treasury Reserves, Nations Institutional Cash Reserves,
SVB Securities Liquid Reserves, SVB Securities Institutional Liquid Reserves
and SVB Securities Horizon Shares are offered through SVB Securities, a
registered broker-dealer and non-bank affiliate of Silicon Valley Bank.
Investments in these products require the involvement of a licensed
representative of SVB Securities.  Investment products offered through SVB
Securities are not insured by the FDIC or any other Federal Government
Agency, are not deposits of or guaranteed by Silicon Valley Bank or its
affiliates, and may lose value.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message