commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Norrod, Dennis G Mr Veridian-MRJ" <Dennis.Nor...@DET.AMEDD.ARMY.MIL>
Subject RE: [ file-upload ] Parsing error - why?
Date Thu, 17 Jul 2003 10:22:32 GMT
Hi Jose,

Instead of:
FileUpload upload = new FileUpload();

Try:
DiskFileUpload upload = new DiskFileUpload();

Later.
Dennis

 -----Original Message-----
From: 	Jose Euclides da Silva Junior - DATAPREVRJ [mailto:Jose.Euclides@rj.previdenciasocial.gov.br]

Sent:	Wednesday, July 16, 2003 5:19 PM
To:	'commons-user@jakarta.apache.org'
Subject:	[ file-upload ] Parsing error - why?

i guess that package FileUpload has a bug whenever it try to parse
HTTPRequest. I always get a  javaNullPointerException error message whenever
my servlet runs.
HERE IS THE CODE:
...
boolean isMultipart = FileUpload.isMultipartContent(request);
             FileUpload upload = new FileUpload(); 
             System.out.println("Passei 0");
ERROR HERE=> List items = upload.parseRequest(request);
             System.out.println("Passei 1");
             Iterator iter = items.iterator();
             while (iter.hasNext())
              {
               //String comment = ((FileItem)i.next()).getString();
                 FileItem item = (FileItem)iter.next();
                 if ( item.isFormField()) 
                  {
                    String name = item.getFieldName();
                    String value = item.getString();
                    System.out.println("item eh: " + name);
                  }
                 else
                  {
                    String nomeArq = item.getName();
                    long tamBytes = item.getSize();
                    int tam = (int) tamBytes;
                   // InputStream uploadFile = item.getInputStream();
                    System.out.println("nome do  arquivo eh: " + nomeArq );
                   // uploadFile.close();
                   // byte [] conteudo;
                   // conteudo.length( tam );
                    byte[] conteudo = item.get();
                }
           }
      System.out.println ("Passei fim");
      
Any help would be appreciated! 
Thanks, Euclides.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

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