Discussions

Web tier: servlets, JSP, Web frameworks: Multiple File Upload using Struts

  1. Multiple File Upload using Struts (5 messages)

    Hi,
    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?

    thanks!
    Preeti

    Threaded Messages (5)

  2. Multiple File Upload using Struts[ Go to top ]

    Preeti:

      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
    Regards
    Chetan
  3. Multiple File Upload using Struts[ Go to top ]

    Thanks for the quick response!
    It was really helpful.

    cheers!
    Preeti
  4. File upload[ Go to top ]

    fyi

    FileUpload in Jakarta Struts is build upon another library.

    The library is http://jakarta.apache.org/commons/fileupload/
  5. 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
  6. 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......

    cheers!