aspose file tools*
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


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "code for file download" Watch "code for file download" New topic
Author

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:
http://your_site/test.jar

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


Fun programming etcetera!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61591
    
  67

Investigate the "content-disposition" header.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

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