Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
07-15-2005, 11:23 PM #1
- Join Date
- Jul 2005
- Thanked 0 Times in 0 Posts
Downloading a file without opening it
Need your help once again. I would like to get a 'Open Save ...' dialog box when the user clicks the link on my page that points to a file of known MIME type (such as .doc, .xls or .pdf etc.). I do not want the relevant application(such as Word, Excel, PPT etc.) to be opened to show the document. I dont want to keep the file without an extension on the server.
Can you please help me on this.
07-16-2005, 12:06 AM #2
- Join Date
- Dec 2004
- In a place far, far away...
- Thanked 1,043 Times in 1,019 Posts
Okay you can pass some headers in php. For example.
If you save a php file with those headers it will download the file that is in the filename. You can link directly to it and the open/save dialogue box will appear.PHP Code:
header("Content-Type: application/pdf; name=agreement.pdf");
header("Content-disposition: attachment; filename=agreement.pdf");
Last edited by _Aerospace_Eng_; 07-16-2005 at 12:24 AM.