note 39032 rejected from function.readfile by didou

From: Date: Thu, 15 Jan 2004 08:22:59 +0000
Subject: note 39032 rejected from function.readfile by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63582@lists.php.net to get a copy of this message
Note Submitter: acwebdesign@socal.rr.com ---- I am trying to make a force-download and then delete file for PDFs. It seems the headers (and possibly the readfile - experiementing gives mixed messages) execute, but any scripts after that do not execute, i.e. unlink($filename). This is a simplified version of what I have: $file_to_download=$_GET["filename"]; $filename=$_GET["filename"]; header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file_to_download)); header("Content-Disposition: attachment; filename=$filename");} if(readfile($file_to_download)==filesize($file_to_download)) //download, and ask if file downloaded 100% { if(!unlink($file_to_download))//if not delete. { exit("Tried to delete file, however error occured. Possible cause: file name invalid. Record will not be deleted."); } else{ echo "Downloaded and deleted.<br>"; } }//if not download else exit("File did not download 100%, therefore it will not be deleted."); If anyone has ANY idea/help, Please email me!

« previous php.notes (#63582) next »