Help with file downloads.

From: Date: Sun, 19 Jul 2009 07:17:26 +0000
Subject: Help with file downloads.
Groups: php.general 
Request: Send a blank email to php-general+get-295565@lists.php.net to get a copy of this message
Hi, My first post. Been writing php from scratch for about 12 months, mainly with what I learnt from the web. Have a problem trying to download multiple files. I'm using the following code: if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); // exit; } from the the php manual under "readfile". The files are text files <1Mb in size. Only the first file is downloaded. (The exit; statement is excluded). What should I do? Thanks Tony

« previous php.general (#295565) next »