fopen/fpassthur

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux