Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do i upload or download a file to server?

 
Bhavani R Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

my actual requirement is i need to create one jsp page which displays list of documents in a specified directory.I slect one of them and download that file and update in the local machine and then upload to server.
If i need to add one new file to server then one add button is there.
Then it will give you the browse option and upload button.then it automatically upload that file in specified directory.
How can i achieve this requirement.
I heard about multipartrequest.But i dont know how to start.
can any one share this type of code or atleast psuedo code.

thankyou very much in advance.
 
Jason Kwok
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this article which may be helpful:

http://faq.javaranch.com/view?FileUpload
 
Bhavani R Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou Jason
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bhavani R Gupta:
Thankyou Jason


I didn't see the previous link but for file uploads, in my opinion, the best out there is from apache

http://jakarta.apache.org/commons/fileupload/
 
Amit Kumargupta
Ranch Hand
Posts: 54
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FAQ link sent by Jason Kwok will give you insight as how can you upload a file to server.

You can use HTML multiple select for displaying the filenames to choose from.
An Example.

Using Jsp you have to populate the options values.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic