• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileUpload using DiskFileUpload

 
Visu Guri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All

I am trying to upload a .xls file using DiskFileUpload.The code snippet is as follows.


DiskFileUpload upload = new DiskFileUpload();

// Set upload parameters
upload.setSizeThreshold(yourMaxMemorySize);
upload.setSizeMax(yourMaxRequestSize);
upload.setRepositoryPath(yourTempDirectory);

// Parse the request
List /* FileItem */ items = upload.parseRequest(request);

If I try to print size and items in the List its displaying 0 and [ ] respectively.
Your valuable help can be appreciated.
Thanks
anm
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Servlets forum.
 
Neeraj Dheer
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the html code? Have you set the enctype attribute of 'form' to multipart/form-data ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic