How do I force the browser to download a wmv file instead of streaming it?

Discussion in 'Web Design' started by henrikjt, May 10, 2009.

to remove all ads.
  1. henrikjt

    henrikjt New Member

    Messages:
    63
    Hi everyone,

    I have some very large video files that i want to share with my family members. I uploaded a video on my server and created a link. If you click on the link it will automatically start to stream the video.

    How do i force the browser to download the file instead??


    I am aware that you can just right click on the link and click "safe link as" however, i want to make it as easy as possible for my older family members.

    I read somewhere that i can zip the file and then it will automatically start the download when you click on the link, however, my older family members probably wont be able to figure out how to unzip the file.

    Is there a way to make this as easy as possible?

    http://www.newpeninsulahomes.com/videos/private/videos.html
     
  2. conor

    conor New Member

    Messages:
    348
    Yes. Name this file download.php and point the link towards this file rather than the wmv file.

    Code:
    <?php
    $filename='nameofthefile';
    header('Content-disposition: attachment; filename='.basename($filename));
    header("Content-Type: force/download");
    header("Content-Transfer-Encoding:binary");
    header('Content-Length: '.filesize($filename));
    readfile($filename);
    ?>
    Replace the text nameofthefile with the actual name of the file you wish to download.
     
  3. emopoops

    emopoops Banned

    Messages:
    66
    where the heck did u get that?
     
  4. wachtn

    wachtn New Member

    Messages:
    107
    Sharing large files with friends and family? Direct download alone might not be the best way to go. Have it available on your site for future downloads but in the beginning, when everyone wants it, you can save bandwidth buy creating a .torrent file and sharing your files that way.
     

Share This Page