Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Reading Multiple files by single submit  RSS feed

 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Report post to moderator
My requirement is to upload multiple filesto server then process these files.

I am able to do it with one file
my coding is below.




Any code help will be really great.

Web server --Tomcat4.1

Thanks in Adv.

[ September 17, 2008: Message edited by: abinash das ]
[ September 17, 2008: Message edited by: abinash das ]
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
You need to add code tags to your code first. Unformatted code is extremely hard to read and will reduce useful responses for your post.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I had faced a similar requirement in one of the projects I was involved in earlier. From all the google-ing I did what I got to know was the selection of multiple files is browser dependent and that the browser that supported this best is Safari. Since the client browser is beyond the scope of the project we considered other alternatives.

1) Provide multiple file upload controls on the page with a single submit for the form.
2) Encourage the upload of Zip files , with all the files sipped into a single zip file.

For the first, the Action would have to read each file from the request individually and process them as required. In the second, The Action copies the sip file onto the server where it then unzips it and then processes each individual file as required. I am not sure what exactly you are trying to accomplish, so I thought I could give you how we dealt with a situation we faced with a similar requirement.

Cheers,
Raj.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
I would assume that you'd simple have several <input type="file"> elements in your HTML page. Did you try that?

The server-side code looks like it handles multiple files already.
[ September 17, 2008: Message edited by: Ulf Dittmer ]
 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Report post to moderator
The code that i am sent is working fine for not for multiple files.
what i require is at the .jsp

there will be 2 options 1.single file selection
2.multiple file selection(folder that contains the files)

when the client choose single radio button it will upload single file that has been selected.

if client chooses multiple radio button then .the whole folder contents of the selected file will be uploaded to the server side.


If Any body is having some sample codes please give.

Regards,
Abinash
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
As Ulf said, you either need multiple 'file' inputs, or you need to look at non HTML (eg flash etc) based solution. You can still receive the files in a servlet, but you'll need to find a different way to send them.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
The code that i am sent is working fine for not for multiple files.
Since there is only a single FILE input field, obviously it can only upload a single file. Have you tried adding more than one field?

if client chooses multiple radio button then .the whole folder contents of the selected file will be uploaded to the server side.

There's no concept of uploading a folder full of files in HTML. Either multiple files need to be uploaded separately, or a zip file (or similar) of all those files must be used.
 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Report post to moderator
OK,
That means if i want to upload files like that in mail sites.
like initially one browse button will be there ,client choose one file,
then press attach, it will be attached to some temporary container,
will give one more option that is add more then i will be able to add one more file.
finally i will submit and all these files will go to server.

How to Achive that !
Any sample code
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
That's a matter of JaVaScript. I'd move this to the HTML/JavaScript forum, but I think it's become too long talking about other topics. I'm going to close this topic, please open a new topic in the JavaScript forum asking how to create the new file elements dynamically.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!