Re: How do I open Save As Dialog Box?

From: Date: Mon, 23 Aug 2004 16:50:21 +0000
Subject: Re: How do I open Save As Dialog Box?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194496@lists.php.net to get a copy of this message
In Safari it'll download the file and then open it. Jon PHP Junkie wrote:
Ave, IT WORKS!! There wasn't one bit of a problem.. I'll just paste the code here again for anyone who might be looking for it. I guess I was very close to it but just doing one thing wrong... I wasn't specifying the Basename directive. <?php $file = "$P/$F"; header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); @readfile($file); ?> Although this doesn't work on MAC... It works on Windows .. In Mac it still opens up the file in it's supported software. But it's not an issue for me. Thanks a ton guys... On 8/23/04 10:51 AM, "John Holmes" <holmes072000@charter.net> wrote:
From: "PHP Junkie" <phpjunkie@mjimm.com>
I have created a File Manager Application for my company which has a place where authorized users can download the stored files. The files are of various MIME Types.. Mainly PDF, TXT & DOC. What I want to do is basically... When the user clicks on the Download Button... The Save As Dialog Box should appear... What is happening right now is that the file opens in it's related software (Word, Acrobat, Notepad etcetera). I don't want the file to open in it's native software. I know I need to use the header ("Content-type: application/octet-stream"); But I don't know how.
     
Read the first comment here: http://us4.php.net/readfile ---John Holmes...


« previous php.general (#194496) next »