note 39670 deleted from function.readfile by tomsommer

From: Date: Mon, 09 Aug 2004 06:49:56 +0000
Subject: note 39670 deleted from function.readfile by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74299@lists.php.net to get a copy of this message
Note Submitter: covertsonic@earthlink.net ---- I found that some of the afforementioned code did not quite meet what i wanted. (I wanted my playlist.m3u file to not open in the browser, but ask the user where to save to). This was tested in IE6 and works fine. I used Patrick's code and some from other sources to complete this. <?PHP $filename=""; // the name the file will have on client computer $file_to_download=""; // the name the file has on the server (or an FTP or HTTP request) header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/octet-stream"); header( "Content-Disposition: attachment; filename=\"$filename\""); header( "Content-Description: File Transfert"); @readfile($file_to_download); ?> I'm not sure that the expiration headers were necessary, but it works, and now i'm not touching it.

« previous php.notes (#74299) next »