dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: How to provide "download video" link

  1. #1
    Join Date
    Aug 2007
    Posts
    2

    How to provide "download video" link

    Hi,

    I'm trying to allow users to download a video from our site but am running into issues with IE and Firefox. When I simply link to the .mov file, I am unable to get the "Save File As" popup to appear and the video simply starts running in the browser. I would like to avoid forcing the user to right click on the link. I've also tried passing the action=save variable but that no longer works. Does anyone have any suggestions?

    Thanks!

  2. #2
    Join Date
    Mar 2007
    Posts
    35
    Just a idea...probably not the best one. Place a link under the video (or where ever) link it to a .zip file of the video. I.E link = /directory/video.zip

    That should enable it to download. (yes I posted a download question earlier, but figured it out)

    As I said, not the greatest way...but should work at least

  3. #3
    Join Date
    Aug 2007
    Posts
    2
    Its a good idea to put the file as a zip.

    But I would have used a server side script like PHP / ASP. With PHP you can actually say how the file link is handled. You can force the download.

    For an idea, you can refer: http://www.php-mysql-tutorial.com/up...ile-server.php

    Regards,
    Sridhar

  4. #4
    Join Date
    Aug 2007
    Posts
    2

    Thanks for your replies...

    I appreciate both your help on this. Unfortunately, I know nothing about PHP -- that would have been a good option. The zip does do the trick -- good thinking! However, if anyone else has a method that doesn't involved having to unzip the file, I'd appreciate your thoughts as well.

    Thanks again!

  5. #5
    Join Date
    Mar 2007
    Posts
    35
    Yeah, I figured the problem behind upzipping the file would be there. Um, also put a link to winzip.com? lol!

    I know of other ways to get the video...but they involve browser add-ons, and third party programs.

  6. #6
    Join Date
    Feb 2007
    Posts
    108
    Try this:

    Paste this code into a new Notepad page and save it as "download.php". Change the "whatever.mpg" to the name of the file you want downloaded:

    <?php
    $filename = "whatever.mpg";

    header("Content-Length: " . filesize($filename));
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=whatever.mpg');

    readfile($filename);
    ?>

    Then add this wherever you want the download link to go:
    <a href="download.php">Download Now!</a>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles