aspose file tools*
The moose likes Servlets and the fly likes Upload multiple file without saving to disk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload multiple file without saving to disk" Watch "Upload multiple file without saving to disk" New topic
Author

Upload multiple file without saving to disk

Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
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 ]

If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
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

Joined: Feb 26, 2008
Posts: 166
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Upload multiple file without saving to disk
 
Similar Threads
Beginner at Image manipulation...
Uploading File - Need to read as stream
Http Connection stream only sends 2048 bytes
Upload a file to unix and invoke a java method
FileUploadException