PHP - Forced header downloads

From: Date: Wed, 20 Mar 2002 01:56:34 +0000
Subject: PHP - Forced header downloads
Groups: php.general 
Request: Send a blank email to php-general+get-89255@lists.php.net to get a copy of this message
I'm trying to use some header functions to force the browser to download quicktime movies. I have a small piece of code that takes the relevant file name from the url and then uses that in the header function. This code sits in get.php. Unfortunately, all I download when I click the link is get.php. Although the name is changed to the desired file name (eg 193430239.mov). The code is: /*retrieve filename from url*/ $current=$REQUEST_URI; $url=parse_url($current); $fileq=$url[query]; $file=$fileq.".mov"; /*force download*/ header("Content-type:application/octet-stream\n"); header("Content-disposition:attachment; filename=\"$file\"\n"); header("Content-transfer-encoding:binary\n"); header("Content-length:".filesize($file)."\n"); /*send file contents */ $fp=fopen($file,"r"); fpassthru($fp); I can't tell you how long it's taken me to download anything and I'm still getting can't add header errors, but at least I'm downloading something. But how do I download the desired movie file....? Many Many Thanks to all who have helped so far, Ian

« previous php.general (#89255) next »