Re: PHP - Forced header downloads

From: Date: Wed, 20 Mar 2002 10:56:03 +0000
Subject: Re: PHP - Forced header downloads
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89307@lists.php.net to get a copy of this message
Ian Wayne wrote: > [...] > > /*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....? You don't need newline ("\n") at the end of your header.... R.

« previous php.general (#89307) next »