Forum Moderators: open

Message Too Old, No Replies

Creating link to file download

trying to trigger download of xml file

         

seashell

7:18 pm on Oct 7, 2003 (gmt 0)

10+ Year Member



My firm wants to offer an xml catalog from the website. Is there a way to trigger a download when clicking on the link and not simply displaying the xml document? I'm guessing this can be done with javascript possibly...

birdbrain

8:29 pm on Oct 7, 2003 (gmt 0)



Hi there seashell,

pop it into a zip file for download

birdbrain

seashell

8:42 pm on Oct 7, 2003 (gmt 0)

10+ Year Member



That's what I ended up doing. I was hoping there was a different way. Thanks!

DrDoc

9:34 pm on Oct 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



header("Content-Type: application/ms-x-download");
header("Content-Disposition: attachment; filename=\"whatever.txt\"");

macrost

10:17 pm on Oct 7, 2003 (gmt 0)

10+ Year Member




header("Content-Type: application/ms-x-download");
header("Content-Disposition: attachment; filename=\"whatever.txt\"");

You learn something new everyday! Thanks DrDoc!

Mac

seashell

7:07 pm on Oct 8, 2003 (gmt 0)

10+ Year Member



I'm still confused. Where do I put this?

DrDoc

7:27 pm on Oct 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...in a PHP script that handles the download.
Direct links won't work.

Sure, you can also make the necessary changes to your .htaccess file.