FW: [PHP-WIN] File download
| From: | Urmil Parikh | Date: | Tue, 13 Mar 2001 05:22:51 +0000 |
| Subject: | FW: [PHP-WIN] File download | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5982@lists.php.net to get a copy of this message | ||
Hi,
I tried with various types including application/octet-stream, but it did not
help.
It seems that IE takes file name from the link (whatever follows after the last
'/' in the link). That is, if my link is
'download.php?path=/abc&file=xyz.txt',
IE prompts for file 'abc&file=xyz.txt' but if I introduce a '/' before file
name, 'download.php?path=/abc&file=/xyz.txt', IE prompts for file 'xyz.txt'.
However, in save dialogue it shows 'download' as file name. If I select 'Open',
it prompts again with 'download' as file name.
May be it is a problem with valid characters in a file name.
Regards, | Linux
Urmil Parikh | It is now safe to turn on your computer
-----Original Message-----
Hi,
I believe your problem is related to the fact that you use
"unknown" in your content-type header. This forces IE to search for an
application to open the file of "unknown" type. Have you tried any other
content-types?
For more info on content-types, see the HTTP1.1 RFC:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
Olivier Hubert
>Hi,
>
>I'm using following code to download a file. IE5 shows the Open/Save dialogue,
>if I select 'Save", it works. But if I select "Open", it again shows the
>same
>dialog with the name of my .php file. Now if I say open, it opens a blank
>file.
>Can anybody help me?
>
> header("Content-type: unknown");
> header("Content-Disposition: attachment; filename=$name;");
> readfile($name);
>
>Regards, | Linux
>Urmil Parikh | It is now safe to turn on your computer