- Posted by: Preeti Ramesh
- Posted on: August 05 2003 06:02 EDT
The requirement is:
The user will select a number of files from his computer and these file names get added to some list on the JSP. Then he clicks on the UPLOAD button. At that point all the files would be uploaded as a background process and the user could continue using the application.
I am using Struts framework. Still a relative newbie - Is this possible?
- Multiple File Upload using Struts by Chetans on August 05 2003 06:27 EDT
- File upload by Sean Sullivan on August 05 2003 18:00 EDT
- Multiple File Upload using Struts by stephen smithstone on August 06 2003 08:34 EDT
With normal JSP framework, if you want to upload the file, you have to go for <form method="post" enctype="multipart/form-data">
this multipart enctype will allow you the push data in chung. later you will have to write a layer which will join all these packages and finally form the file.
My suggestion will be to go for ready to use freeware component.
Component I am using is written by javazoom and it is very easy to use and maintain.
http://www.javazoom.net/index.shtml is a site and upload bean is a component.
Hope this helps
Thanks for the quick response!
It was really helpful.
FileUpload in Jakarta Struts is build upon another library.
The library is http://jakarta.apache.org/commons/fileupload/
there is an example of uploading a single file on the struts website its somewhere in the docs but as i state its only for one file not sure how you will do multiple files maybe multiple options for the file or post the repsonse to the server and keep a cache of it in a property list for that user's session or something
thanks stephen - i came across a similar solution posted on another forum. Select the files one by one and save them as FileItems in a List/Vector in the user session. Then do a batch upload. I am going to try and implement this, if it works I'll post the solution
true, another alternative would be to have several file type input boxes on the jsp, but that looks pretty unattractive......