File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Upload Multiple Files or Folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Upload Multiple Files or Folder" Watch "Upload Multiple Files or Folder" New topic
Author

Upload Multiple Files or Folder

abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
I have a requirement of uploading multiple files or A folder from the client side to the Server's Specific location.
How to achieve the same.


can anybody help me.
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
if you are using struts, you can make use of the struts upload action. If it is plain vanilla JSP. make use of the <file> tag in html, and read the file manually in your java controller class.
Frank Eichfelder
Ranch Hand

Joined: Aug 25, 2003
Posts: 33
As far as I know it is not possible to upload several files or a complete folder in one turn via HTTP to the server.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

Dawn, unless someone specifically mentions Struts or posts in the Struts forum, please do not assume that Struts is in use. Thanks.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

This is most often accomplished by presenting multiple file upload controls to the user. You can even use JavaScript to create as many as you want on demand.
Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
Have a look at Apache Commons FileUpload .


I am just a brick in the wall of Java
abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
Yes I am using Apaches common upload API only, But in my application there is a requirement user needs to upload some 100 files
At one shot.There i am not able to incorporate the Apache commons upload technique to select a Folder containing 100 files.

How to Do it ?
Any Solution will be highly appreciated.
Frank Eichfelder
Ranch Hand

Joined: Aug 25, 2003
Posts: 33
In this case, you can use an applet for selecting a folder on the client side, but you would have to code the tranfer of the individual files to the server yourself (commons-fileupload handles only the server-side of file-transfer as far as I know).
abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
Do any Body have any sample to proceed forward.

if any Body have please give as soon as possible.
Thanks in Adv.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41834
    
  63
If you want to use an applet I'd suggest to look into the Apache Commons HttpClient library. The http://faq.javaranch.com/java/FileUpload page links to some material about both libraries.


Ping & DNS - my free Android networking tools app
abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
Thanxs for the link
http://faq.javaranch.com/java/FileUpload

but it is same as i am using i am using apachec commons only.
But with using browse button to upload files
i cant able to upload Folders .

So, i want help,how can i use an applet at the client side which will communicate with apache commons API
to upload Files.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

As this has become about Applets. I've shifted it to the Applets forum.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41834
    
  63
abinash das wrote:i cant able to upload Folders .

That's why it was suggested that you write an applet that lets the user select a folder. Then you can use the Commons HttpClient library for the applet (client) side of the upload.
abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
Actually I am new To Appelts,So If Some Body have a sample Code of an Applet which Uploads Folder
and is Integrated with the Apache Commons will be really Help full.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41834
    
  63
An extensive applet tutorial can be found at http://java.sun.com/docs/books/tutorial/deployment/applet/index.html

Before you go down that road, make sure that using applets is acceptable with regards to requirements and user base.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Upload Multiple Files or Folder