Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Downloading a file without opening it

    Dear Wizkids,

    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.

    Thanks
    Amilie

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Okay you can pass some headers in php. For example.

    download-pdf.php
    PHP Code:
    <?
    header
    ("Content-Type: application/pdf; name=agreement.pdf");
    header("Content-disposition: attachment; filename=agreement.pdf");
    ?>
    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.
    Last edited by _Aerospace_Eng_; 07-16-2005 at 12:24 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •