wood burning stoves 2.0
The moose likes Servlets and the fly likes code for file download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "code for file download" Watch "code for file download" New topic

code for file download

Udit Manektala
Ranch Hand

Joined: Sep 17, 2006
Posts: 30
The code below fetches me the file I intend to download using the servlet but in the browser, the file is received (downloaded) as POTD ( with no file extension) instead of test.jar

Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
one possible solution would be to have users request:

and map requests for test.jar to your POTD servlet.

Fun programming etcetera!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

Investigate the "content-disposition" header.

[Asking smart questions] [About Bear] [Books by Bear]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

See the JspAndExcel example in the JSP FAQ section of this site for sample code that uses the Content-Disposition header to do this.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link: http://aspose.com/file-tools
subject: code for file download
jQuery in Action, 3rd edition