SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2003
    Location
    Savannah, GA
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    any way to get the php links to pass the referer when right-clicking?

    I'm trying to set up some htaccess files. With mp3's the browser automatically trys to play the file if the user left-clicks the link. So, people have to right click and save as to download the files, but when they do that the referer doesnt get sent to the server, in turn not allowing people access to the files.

    what can I do here?

    Thanks in advance

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One thing I do on my site is to automatically force a download using headers. This way when they click the link it pops up a box saying "Open" or "Save" so they get the choice. It is possible to track the download as well. You can check it out on http://www.the-ante.net/theante.php?...raphy;discid=2

    The code is:

    Code:
    header("Content-type:application/file");
    	header("Content-Disposition:attachment;filename=filename");
    readfile("full/path/to/file");
    It's a little raw, but does the trick.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Louisville, KY
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Save instead of open a link

    Quote Originally Posted by weirdbeardmt
    Code:
    header("Content-type:application/file");
    header("Content-Disposition:attachment;filename=filename");
    readfile("full/path/to/file");
    I'm just starting to set up PHP on my site. I noticed a few of these suggestions, but I can't find exactly the information I need. This post is the best I could find. Here's my situation:

    I've set up phpMyAdmin which accesses MySQL on my host's server. I haven't set up any tables yet because I haven't gotten around to experimenting yet. I'd basically like a quick tutorial on how to get the .wmv files to save automatically instead of opening up when they're clicked on. I can easily do the HTML, but it looks like I have to use PHP to tweak the links this way. In the solution, I assume I can do it so the PHP code can be reused for each of the 11 links so that I don't have to retype each one?

    Much thanks from a newbie....
    ~ Zepfanman.com: When you can't find it on Google


Bookmarks

Posting Permissions

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