RE: [PHP] Re: IE download problem
| From: | Vail, Warren | Date: | Wed, 26 Nov 2003 17:11:30 +0000 |
| Subject: | RE: [PHP] Re: IE download problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171098@lists.php.net to get a copy of this message | ||
Could the problem be the associations stored in the windows system registry?
I've had problems trying to download files whose name ends in a suffix that
is registered as being associated with a given program (i.e. .txt with
notepad, .doc with word). I believe that IE tries to open the file in the
registered application and Netscape doesn't always do that (could be wrong
here, but that's how it seemed to me).
Warren
-----Original Message-----
From: Luis Lebron [mailto:llebron@sigmatech.com]
Sent: Wednesday, November 26, 2003 8:54 AM
To: 'pete M'; php-general@lists.php.net
Subject: RE: [PHP] Re: IE download problem
I tried your code. I'm still getting the same errors.
thanks,
Luis
-----Original Message-----
From: pete M [mailto:pmorgan@ukds.net]
Sent: Wednesday, November 26, 2003 10:52 AM
To: php-general@lists.php.net
Subject: [PHP] Re: IE download problem
thsi si a nighmare area..... and loast days on same problem
This works for me.. hope it does for you
$file = $_GET['file'];
$path = '/www/cgi-bin/docu/personal/'.$file;
//force download dialog
header("Content-type: application/octet-stream\n");
header("Content-disposition: attachment; filename=\"$file\"\n");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($path) . "\n");
//send file contents
$fp=fopen($path, "r");
fpassthru($fp);
Luis Lebron wrote:
> I am working on a script to force downloading a file. The script works
fine
> with NS (4.8 and 7) but does not work correctly with IE 6.0
> I have looked at examples on php.net and have googled for a solution, but
> still can't find a solution. I think IE wants to download the script
instead
> of the file.
>
> Here's what the code I'm working on looks like:
>
> <?php
> $sender=$_GET["sender"];
> $filename=$_GET["filename"];
>
> //Data validation goes here
>
> $filePath="../users/".$sender."/".$filename;
> if(file_exists($filePath))
> {
> Header("Content-Length: ".filesize($filePath));
> Header("Content-type: application/download");
> Header("Content-Disposition-type: attachment");
> Header("Content-Disposition: filename=\"".$filename."\"\n");
> Header("Content-Transfer-Encoding: binary");
> $fp = fopen($filePath,"rb");
> fpassthru($fp);
> }
> ?>
>
>
> The funny thing is that I have a similar script that I use to download an
> sql file and it works correctly.
>
>
> Luis R. Lebron
> Sigmatech, Inc
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php