SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    download wmv/mov files?

    When I click on a link to a wmv file (or any video/music file), the video starts playing in my browser instead of bringing up a "save file as" box.

    Is there a script so when someone clicks on a link, a download box comes up and asks them where to save it?

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    header("Content-Type: application/download");
    header("Content-Disposition: attachment; $filename");
    header("Content-Length: ".filesize($filename));
    readfile($filename); 
    Saul

  3. #3
    SitePoint Addict darkwater23's Avatar
    Join Date
    Nov 2005
    Location
    Omaha, NE
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did find this page that may be useful:

    http://elouai.com/force-download.php

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tell them to right click and save.

  5. #5
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    tell them to right click and save.
    Is there something wrong with forcing a download?

    I do want to reference the file as an ID # to lookup in a database and also log it in the users profile as to what files they have downloaded.

  6. #6
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also this header

    PHP Code:
    header("Content-Type: application/force-download"); 


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
  •