File download question

From: Date: Sun, 06 Sep 2009 18:19:59 +0000
Subject: File download question
Groups: php.general 
Request: Send a blank email to php-general+get-297744@lists.php.net to get a copy of this message
Hi Everyone, I've setup a filedownload which works but i'm having an issue, i've left out but when it downloads it, while it has the correct file it doesn't have a file extension associated with it, I need the .7z extension associated with the filename, can anyone see why that would do this below? I'm sure it's something obvious but i'm new to doing file downloads. Thank you everyone Chris $file = "SOMEFILE.7Z"; $speed = 60; // i.e. 60 kb/s download rate if(file_exists($file) && is_file($file)) { header("Cache-control: private"); header("Content-Type: application/octet-stream"); header("Content-Length: ".filesize($file)); header("Content-Disposition: filename=$file" . "%20"); flush(); $fd = fopen($file, "r"); while(!feof($fd)) { echo fread($fd, round($speed*1024)); // $speed kb at a time flush(); sleep(1); } fclose ($fd); }

« previous php.general (#297744) next »