Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
download attachment
Nirmal JeyaChandra
Greenhorn
Posts: 25
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In php we use
header("Content-Type: octet/stream");
header("Content-Disposition: attachment; filename=\"".$filepath."\"");
to get the download dialog box and to download, open, or save a file what about in
java
.
Scheepers de Bruin
Ranch Hand
Posts: 99
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Try this:
In the doGet or doPost method of you
servlet
response.setHeader("Content-Type", "octet/stream"); response.setHeader("Content-Disposition", "attachment");
Where response is a javax.servlet.http.HttpServletResponse
I am not entirely sure how to do the filename bit, though...
We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
Ulf Dittmer
Rancher
Posts: 43081
77
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This article
explains the process in greater detail.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
making a download servlet to service download managers
Force file download
opeing excell sheet in new window
Http Header Question #2
HTTP Header question
More...