spires Posted November 28, 2008 Share Posted November 28, 2008 Hi Guys Can some one please take a look at me code, as point me in the right direction. I'm trying to get a link, to force a .mov download. http://www.adwordstool.co.uk/test2.php But, I can't seem to get it to work. Here's my code. <?php if ($_GET['name']){ $file = 'http://www.adwordstool.co.uk/videos/tools/'.$_GET['name']; header( 'Expires: Mon, 1 Apr 1974 05:00:00 GMT' ); header( 'Pragma: no-cache' ); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Content-Description: File Download' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Length: '.filesize( $file ) ); header( 'Content-Disposition: attachment; filename="'.basename( $file ).'"' ); header( 'Content-Transfer-Encoding: binary' ); readfile( $file ); } ?> <a href="test2.php?name=split_testing.mov" class="minitext">Split Testing</a> Any help would be great Thanks Link to comment https://forums.phpfreaks.com/topic/134671-forced-download/ Share on other sites More sharing options...
chmpdog Posted November 28, 2008 Share Posted November 28, 2008 I found this topic: http://www.phpfreaks.com/forums/index.php/topic,227052.0.html I dont know if it will help, but you might want to contact whoever started it to see if they have the answer. Link to comment https://forums.phpfreaks.com/topic/134671-forced-download/#findComment-701235 Share on other sites More sharing options...
spires Posted November 28, 2008 Author Share Posted November 28, 2008 No, Thats not quite what I'm after. No worries, I'll just have to do some more research. Thanks anyway Link to comment https://forums.phpfreaks.com/topic/134671-forced-download/#findComment-701242 Share on other sites More sharing options...
spires Posted November 28, 2008 Author Share Posted November 28, 2008 Hi Guys I have worked out how to force the download: http://www.adwordstool.co.uk/test2.php $file_name = $_GET['name']; $file = 'videos/tools/'.$file_name; header("Expires: 0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); header( "Content-Description: File Transfer"); @readfile($file); However, When I download the file, it's not recognizing that it's downloaded a .mov file. I can't open the file in quicktime. Any ideas??? Thanks Link to comment https://forums.phpfreaks.com/topic/134671-forced-download/#findComment-701259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.