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" <[EMAIL PROTECTED]> wrote:



From: "PHP Junkie" <[EMAIL PROTECTED]>



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...





-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to