• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload multiple file without saving to disk

 
Jhakda Velu
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I'm looking at a way to upload 2 files and process them without saving to disk.Basically i have a rates file which contains exchange rates and another file that has expenses. have to get the exchange rates from the first, and do some calculation based on the expenses on the other. most examples i got over the net save the files to the server disk,which i don't want to. A small code example will help me roll.
I can process 1 file this way

Then i read from the InputStream
Now i have to get 2 files,so how do i put/get 2 files in the stream?

Thanks

Jhakda
[ November 27, 2008: Message edited by: Jhakda Velu ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fileupload library by Jakarta Commons has configurations settings for handling uploads in memory, by writing to disk, or by choosing one or the other, dynamically according to the file size.

http://commons.apache.org/fileupload/using.html
 
Jhakda Velu
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben
You have pointed to the right direction,thanks a lot.

I will update once the things are done.

Thanks
Jhakda
 
Jhakda Velu
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I'm giving a small snippet about the way i went about doing the task.
I added the foll code to the Jsp form tag


Then in my servlet i cheked for multipart content


If isMultipart is true i did the following to get the streams to the uploaded files

where myWorkBook is of type jxl.Workbook.

Hope someone finds it helpful

Jhakda
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic