Hello all,
I'm struggling with this for some time now, and I haven't found a clear answer anywhere yet.
My client wants to have people download a file, but only once. I'm using the file push method:
header("Content-transfer-encoding: binary\n");
header( "Content-type: " . $SESSION["file_type"] . "\n" );
// Set the content length to file length
header( "Content-Length: " . $SESSION["file_size"] ."\n" );
// Name the file
header( "Content-Disposition: attachment; filename=" . $SESSION["file_name"] ."\n");
// Read the original source file
$handle = fopen(UPLOAD_DIR . $SESSION["uploader"] . "\" . $SESSION["downloader"] . "\" . $SESSION["file_name"], rb, false);
//readfile( UPLOAD_DIR . $SESSION["uploader"] . "\" . $SESSION["downloader"] . "\" . $_SESSION["file_name"], false );
fpassthru($handle);
fclose($handle);
and then I'd like to redirect the browser to another page, so they won't be able to download the file again.
Is there any way I can do this without using Javascript? Or is there a better way I haven't thought of?
Thanks in advance,
Steven