note 6433 deleted from header by ronabop

From: Date: Fri, 11 Aug 2000 15:17:03 +0000
Subject: note 6433 deleted from header by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-1162@lists.php.net to get a copy of this message
When a user clicks on an URL, the browser will normally either download (such as an .exe) or display the document (if the url points to a .gif, .jpg, .txt or .html document for example). I want to make sure that this will not happen and that the user will always be presented with a download screen. I also want to keep users from downloading certain files directely, only through my PHP interface. Or, differently put, I want them to be able to access binaries for download from directories normally not accessible by http. So, I want to make a binary dump program, and use it with passthru() something like this: Header("header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename="suggested-filename"" ); passthru("dump /tmp/somefile.exe"); But it doesn't work.. I get the message "document contains no data" or something.. What's the right way for doing this?

« previous php.notes (#1162) next »