I recently put all of the videos on my site on Google Video, but I want people to still be able to download the (much better looking) .MOV versions that I keep on the site; however, without "save target as"-ing (and it's FireFox, Opera, etc, etc equivalents), the file will stream. Aside from putting the file in a ZIP archive, is there any way to force the download? I haven't found any help elsewhere...<br /><br />Example of one of the pages in question: <a href="http://www.sjbmx.com/videos_06assorted.php" target="_blank">http://www.sjbmx.com/videos_06assorted.php</a><!--content-->
I don't know if you can do that from the programming end of things. I do know that you can change an option within the browser to save rather than run the file. For example, Firefox offers Tools -> Options -> Content -> Manage Files, where you can browse to the .MOV extension and tell it you want to download the files.<!--content-->
This script has worked for me in the past.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />/*  setup  - create a PHP file called fdownload.php with the lines below.<br /><br />Change the $filedir to point to you path on the server<br /><br />Call from a link like this: <br /><br /> <a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"www.******/fdownload.php?file=yourfilename"><br /><br />*/<br /><br />$filedir = "/home/yourcpanelname/public_html/";<br /><br />$file = "$filedir".$_GET['file']."";<br />if (file_exists(basename($file))) {<br />header("Content-Description: File Transfer");<br />header("Content-Type: application/force-download");<br />header("Content-Disposition: attachment; filename=".basename($file));<br />readfile($file);<br />} else {<br />echo "$file<br>";<br />echo basename($file);<br />echo "<br>No File Found";<br />}<br />?><!--c2--></div><!--ec2--><!--content-->
<!--quoteo(post=198710:date=Jan 15 2007, 12:28 PM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Jan 15 2007, 12:28 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=198710"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->This script has worked for me in the past.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />/*  setup  - create a PHP file called fdownload.php with the lines below.<br /><br />Change the $filedir to point to you path on the server<br /><br />Call from a link like this: <br /><br /> <a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"www.******/fdownload.php?file=yourfilename"><br /><br />*/<br /><br />$filedir = "/home/yourcpanelname/public_html/";<br /><br />$file = "$filedir".$_GET['file']."";<br />if (file_exists(basename($file))) {<br />header("Content-Description: File Transfer");<br />header("Content-Type: application/force-download");<br />header("Content-Disposition: attachment; filename=".basename($file));<br />readfile($file);<br />} else {<br />echo "$file<br>";<br />echo basename($file);<br />echo "<br>No File Found";<br />}<br />?><!--c2--></div><!--ec2--><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Thanks, Bruce. I'll try that out when I get home from work.<!--content-->
Couldn't get that one to work, but I finally found one that works, anyway. I never even thought of searching for "force download script"; I'd been searching for "force download php" the whole time.<br /><br /><a href="http://elouai.com/force-download.php" target="_blank">http://elouai.com/force-download.php</a><!--content-->
I've used that one too. Sorry the first one did not work for you.<!--content-->
<!--quoteo(post=198763:date=Jan 16 2007, 04:49 AM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Jan 16 2007, 04:49 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=198763"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I've used that one too. Sorry the first one did not work for you.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Oh, its no problem. I probably messed up in setting it up, anyway.<!--content-->
Why not just add this to your .htaccess<br /><br />AddType application/octet-stream .mov<!--content-->
I don't know if you can do that from the programming end of things. I do know that you can change an option within the browser to save rather than run the file. For example, Firefox offers Tools -> Options -> Content -> Manage Files, where you can browse to the .MOV extension and tell it you want to download the files.<!--content-->
This script has worked for me in the past.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />/*  setup  - create a PHP file called fdownload.php with the lines below.<br /><br />Change the $filedir to point to you path on the server<br /><br />Call from a link like this: <br /><br /> <a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"www.******/fdownload.php?file=yourfilename"><br /><br />*/<br /><br />$filedir = "/home/yourcpanelname/public_html/";<br /><br />$file = "$filedir".$_GET['file']."";<br />if (file_exists(basename($file))) {<br />header("Content-Description: File Transfer");<br />header("Content-Type: application/force-download");<br />header("Content-Disposition: attachment; filename=".basename($file));<br />readfile($file);<br />} else {<br />echo "$file<br>";<br />echo basename($file);<br />echo "<br>No File Found";<br />}<br />?><!--c2--></div><!--ec2--><!--content-->
<!--quoteo(post=198710:date=Jan 15 2007, 12:28 PM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Jan 15 2007, 12:28 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=198710"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->This script has worked for me in the past.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />/*  setup  - create a PHP file called fdownload.php with the lines below.<br /><br />Change the $filedir to point to you path on the server<br /><br />Call from a link like this: <br /><br /> <a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"www.******/fdownload.php?file=yourfilename"><br /><br />*/<br /><br />$filedir = "/home/yourcpanelname/public_html/";<br /><br />$file = "$filedir".$_GET['file']."";<br />if (file_exists(basename($file))) {<br />header("Content-Description: File Transfer");<br />header("Content-Type: application/force-download");<br />header("Content-Disposition: attachment; filename=".basename($file));<br />readfile($file);<br />} else {<br />echo "$file<br>";<br />echo basename($file);<br />echo "<br>No File Found";<br />}<br />?><!--c2--></div><!--ec2--><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Thanks, Bruce. I'll try that out when I get home from work.<!--content-->
Couldn't get that one to work, but I finally found one that works, anyway. I never even thought of searching for "force download script"; I'd been searching for "force download php" the whole time.<br /><br /><a href="http://elouai.com/force-download.php" target="_blank">http://elouai.com/force-download.php</a><!--content-->
I've used that one too. Sorry the first one did not work for you.<!--content-->
<!--quoteo(post=198763:date=Jan 16 2007, 04:49 AM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Jan 16 2007, 04:49 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=198763"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I've used that one too. Sorry the first one did not work for you.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Oh, its no problem. I probably messed up in setting it up, anyway.<!--content-->
Why not just add this to your .htaccess<br /><br />AddType application/octet-stream .mov<!--content-->