Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-09-2005, 02:10 AM   PM User | #1
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
creating links to open/download files

Is there a certain way to code a link to a file that will prompt the user to either open the file or save it to disk (as opposed to clicking on the link and having the file open inside the browser)?

Thanks.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 03-09-2005, 03:40 AM   PM User | #2
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
Internet Explorer

Technically, yes (or maybe... as no one seems to have actually tried it, yet): http://www.codingforums.com/showthread.php?t=51195
__________________
*this message will self destruct in n-seconds*
codegoboom is offline   Reply With Quote
Old 03-09-2005, 04:02 AM   PM User | #3
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Looks like you can do it with server-side programming (i.e., PHP)...Here's an excerpt from http://us2.php.net/header:

Quote:
If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
PHP Code:
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?>
__________________
Regards, R.J.

Last edited by chump2877; 03-09-2005 at 04:10 AM..
chump2877 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:51 PM.


Advertisement
Log in to turn off these ads.