commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Euclides da Silva Junior - DATAPREVRJ <Jose.Eucli...@rj.previdenciasocial.gov.br>
Subject [ file-upload ] Parsing error - why?
Date Wed, 16 Jul 2003 21:18:40 GMT
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.



Mime
View raw message