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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    download the file instead of opening it

    hey guys need help here

    i want to make the user download the file txt pdf whatever instead of open the content

    thankss a lot!

  • #2
    New Coder
    Join Date
    Dec 2009
    Posts
    96
    Thanks
    1
    Thanked 2 Times in 2 Posts
    I don't know any code to set the link to either open or download.... But what you could do if that helps, is placing all files into a .rar or .zip file. Then, the browser will ask by default what they wanna do, open or download. Does that help or work for you? I can look if I can get another solution if you like.

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post
    I`m sorry but i need to downloa the file itself like .txt .*** .mp4 .mkv

    i'd be glad if you could help me please!

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    If your server is apache, then add the following into your htaccess file
    Code:
    AddType application/octet-stream .pdf .txt .mp4
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    831
    Thanks
    10
    Thanked 79 Times in 77 Posts
    Download Link:

    You have to zip the file to trigger the browser's response to Save File. Otherwise, it will call a program to play the media file.

    How to Zip or Unzip a file:
    http://www.mantex.co.uk/samples/down-zip.htm
    http://office.microsoft.com/en-us/he...276901033.aspx

    Making an image a link:

    Code:
    <p><a href="URL path to zipped file" title="Mouseover Description"><img style="width: XXpx; height: YYpx; border: 0;" src="Path to image" alt="Text Description"></a></p>
    Text Link only:

    Code:
    <p><a href="URL path to zipped file" title="Mouseover Description">Link Text Description</a></p>
    You can change the "p" tags to div tags and style as needed.

    Forcing File Downloads in PHP: http://elouai.com/force-download.php
    Using PHP Headers to Force Download: http://www.ryboe.com/tutorials/php-h...force-download
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

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