• Post Reply Bookmark Topic Watch Topic
  • New Topic

File upload requirement analysis

 
vijay jamadade
Ranch Hand
Posts: 244
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

First i will give you idea about my requirement. I want to upload 100 to 200 of files at a time in database blob data. The interface should show the list of files which are available on the client machine which is accessing that link. That means i want to display the folder structure of the machine accessing the url of my application, not the application servers. The user will select the multiple files and after submit that files will get uploaded in the database.

What kind of solution should i prefer for this as it requires browsing of the client machine and sending the selected files to the server for uploading.

Please discuss

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you posted this in the Servlets forum I assume that this should be done in a web app. HTML forms can upload multiple files to a servlet container, but you would need to select the files one by one. There's no way to select a directory, or multiple files in the same file selection dialog.

If you want to select several files at the same time you need to use an applet, or a similar technology.

The file handling in the servlet container can be done using a library like Apache Commons FileUpload.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet or webstart application is indeed a much better idea. Under each Swing´s JFileChooser allows you to select multiple files at once.
 
vijay jamadade
Ranch Hand
Posts: 244
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bauke.

There is one more option i am thinking of is save the files to a specific folder on specific machine and when i will select upload the application will get the files from that location by default. But i dont know how to get all the files objects in one go in java class and send it for further processing. Please tell how to do this? Is it possible in struts 2.0
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Send the files one by one.

Struts is irrelevant. It´s finally all about HTML. And there in you can perfectly embed an applet or webstart app.
 
vijay jamadade
Ranch Hand
Posts: 244
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bauke,

Actually my requirement got changed to uploading a folder from the specific intranet machine so I found the solution. Using directory I am getting the array of java file objects in the action from the hard coded destination (shared folder) and I am inserting them in database by converting into the bytes.

.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good work.

By the way, there should be in fact no means of converting. They are already been stored as bytes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!