• Post Reply Bookmark Topic Watch Topic
  • New Topic

Upload and Download a file

 
Poornima Sharma
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
Can we upload or download a file using servlets.
If yes how can we.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, see the JSP FAQ for an entry on uploading. Downloading is as easy as including a link to the file on an HTML page.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If for some reason putting the file in a public directory (where an href link can find it) is not an option, you can use a simple servlet to stream it to the client. See http://faq.javaranch.com/java/CodeBarnSimpleStream for an example.
 
Deepti chhabra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you please post the code, that allows you to download the file from the server.

Thanks
Deepti
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!