Beeronius Posted January 15, 2007 Posted January 15, 2007 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... Example of one of the pages in question: http://www.sjbmx.com/videos_06assorted.php Quote
nortk Posted January 15, 2007 Posted January 15, 2007 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. Quote
TCH-Bruce Posted January 15, 2007 Posted January 15, 2007 This script has worked for me in the past. ><?php /* setup - create a PHP file called fdownload.php with the lines below. Change the $filedir to point to you path on the server Call from a link like this: <a href="www.******/fdownload.php?file=yourfilename"> */ $filedir = "/home/yourcpanelname/public_html/"; $file = "$filedir".$_GET['file'].""; if (file_exists(basename($file))) { header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); readfile($file); } else { echo "$file<br>"; echo basename($file); echo "<br>No File Found"; } ?> Quote
Beeronius Posted January 15, 2007 Author Posted January 15, 2007 This script has worked for me in the past. ><?php /* setup - create a PHP file called fdownload.php with the lines below. Change the $filedir to point to you path on the server Call from a link like this: <a href="www.******/fdownload.php?file=yourfilename"> */ $filedir = "/home/yourcpanelname/public_html/"; $file = "$filedir".$_GET['file'].""; if (file_exists(basename($file))) { header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); readfile($file); } else { echo "$file<br>"; echo basename($file); echo "<br>No File Found"; } ?> Thanks, Bruce. I'll try that out when I get home from work. Quote
Beeronius Posted January 16, 2007 Author Posted January 16, 2007 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. http://elouai.com/force-download.php Quote
TCH-Bruce Posted January 16, 2007 Posted January 16, 2007 I've used that one too. Sorry the first one did not work for you. Quote
Beeronius Posted January 28, 2007 Author Posted January 28, 2007 I've used that one too. Sorry the first one did not work for you. Oh, its no problem. I probably messed up in setting it up, anyway. Quote
carbonize Posted January 29, 2007 Posted January 29, 2007 Why not just add this to your .htaccess AddType application/octet-stream .mov Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.