fopen/fpassthur

From: Date: Tue, 14 Dec 2004 16:19:31 +0000
Subject: fopen/fpassthur
Groups: php.general 
Request: Send a blank email to php-general+get-204303@lists.php.net to get a copy of this message
Hi all, I have created a download manger to handle files, when a user clicks a link the file is sent though fopen() and fpassthru() like this: header("Content-type: application/octet-stream"); header("Content-disposition: attachment; filename=" . $file['filename']); header("Content-transfer-encoding: binary"); header("Content-length: " . filesize($file['path'] . $file['filename'])); // get file contents $file = @fopen($file['path'] . $file['filename'], 'r'); // output fpassthru($file); exit; is this the most practical way of doing it? i don't want to display file location.. the script seems to be working okay, but i was just looking for opinions on the method. also, is it possible to insert a txt file on the fly if the file they're downloading is a ZIP file? if so, any ideas how?

« previous php.general (#204303) next »