By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Download an XML file from the server

P: n/a
I need to allow users to download and save XML files from the server to
their local client drive. [This is so users can export data from the
server, to be imported into other programs for analysis.]

How can this be accomplished? I either want the link to basically
present the user with a "save" option, or figure out some way to do it
in javascript.

Thanks.
Oct 20 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2008-10-20 09:21, Jon Mcleod wrote:
I need to allow users to download and save XML files from the server to
their local client drive. [...] I either want the link to basically
present the user with a "save" option, or figure out some way to do it
in javascript.
This has nothing to do with javascript. The server should send a
"Content-Disposition: attachment; filename=foo.xml" header.
- Conrad
Oct 20 '08 #2

P: n/a
Conrad Lender wrote:
On 2008-10-20 09:21, Jon Mcleod wrote:
>I need to allow users to download and save XML files from the server to
their local client drive. [...] I either want the link to basically
present the user with a "save" option, or figure out some way to do it
in javascript.

This has nothing to do with javascript.
Full ACK
The server should send a "Content-Disposition: attachment;
filename=foo.xml" header.
Content-Type: application/octet-stream

is the more compatible solution.

See also:
<http://www.hanselman.com/blog/TheContentDispositionSagaControllingTheSuggestedFi leNameInTheBrowsersSaveAsDialog.aspx>
PointedEaars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Oct 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.