commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikhil S. Kamath" <nikhi...@mastek.com>
Subject PortletFileUpload parse not working properly
Date Mon, 21 Nov 2005 11:50:49 GMT
I am trying to use the portlet file upload classes from  1.1 dev commons-fileupload jar.

In the code below, when upload(PortletFileUpload) parses the request ,no exception is throws
and the method just returns

i m saying this because on console i get  println("starting request parsing") before parsing
but not println("request parsed"); which is

just next line of the code.the most surprising part is that no exception is thrown and method
just returns.

Am i doing something wrong.I have checked that SizeThreshold,SizeMax have properly been set

Incoorect values gave me FileUploadException

I would be glad if someone helped me out

 

Code

public void uploadAction(ActionRequest request, ActionResponse response) throws PortletException,
IOException 

{

            if(PortletFileUpload.isMultipartContent(request))

                        {

                                    DiskFileItemFactory diskFileItemFactory=new DiskFileItemFactory();


                                    diskFileItemFactory.setRepository(new File(TempDirectory));


                                    diskFileItemFactory.setSizeThreshold(MaxMemorySize); 

                        

                                    PortletFileUpload upload = new PortletFileUpload(diskFileItemFactory);

                                    upload.setSizeMax(MaxRequestSize);

                                    try

                                    {

                                                System.out.println("starting request parsing");

                                                List items = upload.parseRequest(request);
                                 

                                                System.out.println("request parsed");

                                    

                                                Iterator iter = items.iterator();

                                                while (iter.hasNext())

                                                {

                                                            System.out.println("iteator hasitems");

                                                            FileItem item = (FileItem) iter.next();

                                                            

                                                            if (!item.isFormField())

                                                            {

                                                                        System.out.println(item.getName());

                                                                        processUploadedFile(item);

                                                            }

                                                }

                                    }

                                    catch(FileUploadException ioe)

                                    {

                                                System.out.println("FileUploadException Exception");

                                                                                         
      

                                    }

                                    catch(Exception ioe)

                                    {

                                                System.out.println("General Exception");

                                                                                         
      

                                    }

                        }

            else

            {

                        System.out.println("Not Multipart");

            }

 

}

 

 

Regards,

Nikhil

 

MASTEK 
"Making a valuable difference"
Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCO

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited,
unless specifically indicated to that effect. Mastek Limited does not accept any responsibility
or liability for it. This e-mail and attachments (if any) transmitted with it are confidential
and/or privileged and solely for the use of the intended person or entity to which it is addressed.
Any review, re-transmission, dissemination or other use of or taking of any action in reliance
upon this information by persons or entities other than the intended recipient is prohibited.
This e-mail and its attachments have been scanned for the presence of computer viruses. It
is the responsibility of the recipient to run the virus check on e-mails and attachments before
opening them. If you have received this e-mail in error, kindly delete this e-mail from all
computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message