commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Collin <coll...@laboiteaprog.com>
Subject Re: upload file [FileUpload]
Date Wed, 15 Mar 2006 16:04:29 GMT
Le Dimanche 12 Mars 2006 11:41, Stephen Colebourne a écrit :
> Typo: enctypetype
>
> Stephen
>
ok corrected


DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);	
try{
  List items = upload.parseRequest(request);
  Iterator iter = items.iterator();
  if (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();					
    File uploadedFile = new File(item.getName());
    try{
      item.write(uploadedFile);
    }catch (Exception e) {
      e.printStackTrace();
    }		
  } 
}catch (FileUploadException e) {
  e.printStackTrace();
}
request.getRequestDispatcher("corrector.jsp").forward(request,response);

the file seem uploaded, browser forwarm to corrector.jsp... but when i don't 
fine the file uploaded on the hd...


-- 
www.laboiteaprog.com

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


Mime
View raw message