[PHP] Re: force download in IE

2001-08-24 Thread Ralph Deffke

I went through the same problem. the simplest solution with browsers like IE
5.5 is to  click with the right buttom on the link an choose "save this
location". You could mention this on the your page in a "if you have trouble
dwonloading" sentence.

a very stable solution would be to make a selfextracting archive and provige
two download links, one for people having the helper application installed and
want to just view it or those who want to download it.

David Minor schrieb:

> Can anybody tell me why this doesn't work in IE?  I need to force download
> mp3 files instead of IE5.5 trying to apply a helper app.  This code works
> fine for NN.
>
> // detect for MSIE bug
> if (strstr($HTTP_USER_AGENT, "MSIE"))
> $attachment = "";
> else
> $attachment = " attachment;";
>
> // stream file to user
> header("Content-Type: application/octet-stream");
> header("Content-Disposition:$attachment filename=$filename");
> header("Content-Length: ".filesize($tmp_file));
> header("Content-Transfer-Encoding: binary");
> readfile($tmp_file);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: force download in IE

2001-08-24 Thread Ralph Deffke

I went through the same problem. the simplest solution with browsers like IE
5.5 is to  click with the right buttom on the link an choose "save this
location". You could mention this on the your page in a "if you have trouble
dwonloading" sentence.

a very stable solution would be to make a selfextracting archive and provige
two download links, one for people having the helper application installed and
want to just view it or those who want to download it.

David Minor schrieb:

> Can anybody tell me why this doesn't work in IE?  I need to force download
> mp3 files instead of IE5.5 trying to apply a helper app.  This code works
> fine for NN.
>
> // detect for MSIE bug
> if (strstr($HTTP_USER_AGENT, "MSIE"))
> $attachment = "";
> else
> $attachment = " attachment;";
>
> // stream file to user
> header("Content-Type: application/octet-stream");
> header("Content-Disposition:$attachment filename=$filename");
> header("Content-Length: ".filesize($tmp_file));
> header("Content-Transfer-Encoding: binary");
> readfile($tmp_file);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: force download in IE -- conclusion

2001-08-23 Thread Tim Frank

I have had success getting IE 5.5 for PC recognising the suggested 
filename by changing the content type to something other than 
application/octet-stream.  If it was left as that for IE 5.5(which the 
script snippet indicates) it would tend to take the filename of the 
script that executed it, or HTML file where the link to the script was 
located.

I have been using the forced download for txt and pdf files, dynamically 
generated with PHP of course, for about 2 years.  It is a pain in the ass 
to figure out the correct combinations for every different IE browser.  
Luckily it is a campus only system and the users are on PC or Linux.

Oh, and there is a bug if you try to force download in IE over an SSL 
connection WHEN USING SESSIONS.  I stumbled accross someone working on 
the SquirrelMail project who found a solution.  You just have to send 
these two extra headers to get IE force these downloads over SSL

if (ereg("MSIE", $HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
header('Pragma: ');
header('Cache-Control: cache');
}

That one had me stumped for 2 years and I had to bail out of the sessions 
and pass everything through the URL to force a download.

Hope that helps too.

Tim Frank

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 22/08/01, 5:47:26 PM, [EMAIL PROTECTED] (Pierre-Yves) wrote regarding 
Re: [PHP] Re: force download in IE -- conclusion:


> I worked on a script like yours for a looong time now!

> I need to force the download of various type of file, doc, pdf, zip, even
> html!

> Your script works fine on Opera 5.02 and netscape 4.76 on my win NT 4.0 
box,
> but
> not on IE 5.5 On this one, it offers me to download the script file but
> instead of being
> a php file it has now an html extension !!

> Anyhow, I do have a download by email attachment button also, because I 
gave
> up on trying
> to find a script to force download....

> py


> - Original Message -
> From: "David Minor" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 4:10 PM
> Subject: [PHP] Re: force download in IE -- conclusion


> > I ran some tests of different header configurations of 6 browser/platform
> > combinations to find out what worked and what didn't.  I didn't cover all
> of
> > the platforms available, just those that my user-base uses, so this isn't
> > complete.
> >
> > combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7
> for
> > Mac 9.1.  I tested all of these browsers using/not using 'attachment' in
> the
> > Content-Disposition header.  and also changed out the Content-Type header
> > with 'application/octet-stream', 'application/download', and '*/*'.
> >
> > Here's the summary and what I did to make things work as well as 
possible.
> > My goal is to prompt the user with a save-as dialog for an mp3 file.
> >
> > IE5.5 for Mac always uses the quicktime plugin to play the file no matter
> > what the disposition or type is.  (also no matter what the file extension
> > is.  Couldn't figure out how to trick it to download the file.)
> >
> > IE5.5 for Win98 would attempt to download the file if
> ("content-disposition:
> > attachment; filename=") attachment was there.
> >
> > All 3 of the Win98 browsers would do prompt with as few clicks as 
possible
> > when content-type was "application/octet-stream".  Therefore,  I test in
> my
> > script for the Mac users and give them "Content-type:
> application/downlaod"
> > while I give other users "Content-Type: application/octet-stream".  Of
> > course, this doesn't help the IE5.5 Mac users who still have to use
> > "Downlaod Link to Disk" routine to get a save-as prompt.
> >
> > Anyone who sees different ways this could be done, please respond.
> >
> > Here's my code:
> >
> > if (eregi("mac",$HTTP_USER_AGENT))
> >$type = "application/download";
> > else
> >$type = "application/octet-stream";
> >
> > // stream file to user
> > header("Content-Type: $type");
> > header("Content-Disposition: attachment; filename=$filename");
> > header("Content-Length: ".filesize($tmp_file));
> > header("Content-Transfer-Encoding: binary");
> > readfile($tmp_file);
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: force download in IE -- conclusion

2001-08-23 Thread Tom Rogers

Hi
This is the way I force save prompt on .html files .maybe useful (only 
tested on ie) looks wierd but it works :)


Tom


At 06:10 AM 23/08/01, David Minor wrote:
>I ran some tests of different header configurations of 6 browser/platform
>combinations to find out what worked and what didn't.  I didn't cover all of
>the platforms available, just those that my user-base uses, so this isn't
>complete.
>
>combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7 for
>Mac 9.1.  I tested all of these browsers using/not using 'attachment' in the
>Content-Disposition header.  and also changed out the Content-Type header
>with 'application/octet-stream', 'application/download', and '*/*'.
>
>Here's the summary and what I did to make things work as well as possible.
>My goal is to prompt the user with a save-as dialog for an mp3 file.
>
>IE5.5 for Mac always uses the quicktime plugin to play the file no matter
>what the disposition or type is.  (also no matter what the file extension
>is.  Couldn't figure out how to trick it to download the file.)
>
>IE5.5 for Win98 would attempt to download the file if ("content-disposition:
>attachment; filename=") attachment was there.
>
>All 3 of the Win98 browsers would do prompt with as few clicks as possible
>when content-type was "application/octet-stream".  Therefore,  I test in my
>script for the Mac users and give them "Content-type: application/downlaod"
>while I give other users "Content-Type: application/octet-stream".  Of
>course, this doesn't help the IE5.5 Mac users who still have to use
>"Downlaod Link to Disk" routine to get a save-as prompt.
>
>Anyone who sees different ways this could be done, please respond.
>
>Here's my code:
>
>if (eregi("mac",$HTTP_USER_AGENT))
>$type = "application/download";
>else
>$type = "application/octet-stream";
>
>// stream file to user
>header("Content-Type: $type");
>header("Content-Disposition: attachment; filename=$filename");
>header("Content-Length: ".filesize($tmp_file));
>header("Content-Transfer-Encoding: binary");
>readfile($tmp_file);
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: force download in IE -- conclusion

2001-08-22 Thread Elias Santiago

Not necessarily an answer but on my work (a computer center for medical
students) we use a propietary Perl web-based course software and when doing
attachments on email messages on the system's bulletin board, the system
sends a header with "appplication/octet-stream" and IE 5.5 "attaches" the
.html extension to some downloads (not all). It is a known IE 5.5 bug, the
only way we have done to try to circumvent it (doesn't work everytime) is to
use the "Save Link As" feature, and sometimes that does the trick.   IE 5.5
is buggy.

"Pierre-Yves" <[EMAIL PROTECTED]> wrote in message
004901c12b54$08c1cb50$0100a8c0@py">news:004901c12b54$08c1cb50$0100a8c0@py...
> I worked on a script like yours for a looong time now!
>
> I need to force the download of various type of file, doc, pdf, zip, even
> html!
>
> Your script works fine on Opera 5.02 and netscape 4.76 on my win NT 4.0
box,
> but
> not on IE 5.5 On this one, it offers me to download the script file but
> instead of being
> a php file it has now an html extension !!
>
> Anyhow, I do have a download by email attachment button also, because I
gave
> up on trying
> to find a script to force download
>
> py
>
>
> - Original Message -
> From: "David Minor" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 4:10 PM
> Subject: [PHP] Re: force download in IE -- conclusion
>
>
> > I ran some tests of different header configurations of 6
browser/platform
> > combinations to find out what worked and what didn't.  I didn't cover
all
> of
> > the platforms available, just those that my user-base uses, so this
isn't
> > complete.
> >
> > combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7
> for
> > Mac 9.1.  I tested all of these browsers using/not using 'attachment' in
> the
> > Content-Disposition header.  and also changed out the Content-Type
header
> > with 'application/octet-stream', 'application/download', and '*/*'.
> >
> > Here's the summary and what I did to make things work as well as
possible.
> > My goal is to prompt the user with a save-as dialog for an mp3 file.
> >
> > IE5.5 for Mac always uses the quicktime plugin to play the file no
matter
> > what the disposition or type is.  (also no matter what the file
extension
> > is.  Couldn't figure out how to trick it to download the file.)
> >
> > IE5.5 for Win98 would attempt to download the file if
> ("content-disposition:
> > attachment; filename=") attachment was there.
> >
> > All 3 of the Win98 browsers would do prompt with as few clicks as
possible
> > when content-type was "application/octet-stream".  Therefore,  I test in
> my
> > script for the Mac users and give them "Content-type:
> application/downlaod"
> > while I give other users "Content-Type: application/octet-stream".  Of
> > course, this doesn't help the IE5.5 Mac users who still have to use
> > "Downlaod Link to Disk" routine to get a save-as prompt.
> >
> > Anyone who sees different ways this could be done, please respond.
> >
> > Here's my code:
> >
> > if (eregi("mac",$HTTP_USER_AGENT))
> >$type = "application/download";
> > else
> >$type = "application/octet-stream";
> >
> > // stream file to user
> > header("Content-Type: $type");
> > header("Content-Disposition: attachment; filename=$filename");
> > header("Content-Length: ".filesize($tmp_file));
> > header("Content-Transfer-Encoding: binary");
> > readfile($tmp_file);
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: force download in IE -- conclusion

2001-08-22 Thread pierre-yves

I worked on a script like yours for a looong time now!

I need to force the download of various type of file, doc, pdf, zip, even
html!

Your script works fine on Opera 5.02 and netscape 4.76 on my win NT 4.0 box,
but
not on IE 5.5 On this one, it offers me to download the script file but
instead of being
a php file it has now an html extension !!

Anyhow, I do have a download by email attachment button also, because I gave
up on trying
to find a script to force download

py


- Original Message -
From: "David Minor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 22, 2001 4:10 PM
Subject: [PHP] Re: force download in IE -- conclusion


> I ran some tests of different header configurations of 6 browser/platform
> combinations to find out what worked and what didn't.  I didn't cover all
of
> the platforms available, just those that my user-base uses, so this isn't
> complete.
>
> combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7
for
> Mac 9.1.  I tested all of these browsers using/not using 'attachment' in
the
> Content-Disposition header.  and also changed out the Content-Type header
> with 'application/octet-stream', 'application/download', and '*/*'.
>
> Here's the summary and what I did to make things work as well as possible.
> My goal is to prompt the user with a save-as dialog for an mp3 file.
>
> IE5.5 for Mac always uses the quicktime plugin to play the file no matter
> what the disposition or type is.  (also no matter what the file extension
> is.  Couldn't figure out how to trick it to download the file.)
>
> IE5.5 for Win98 would attempt to download the file if
("content-disposition:
> attachment; filename=") attachment was there.
>
> All 3 of the Win98 browsers would do prompt with as few clicks as possible
> when content-type was "application/octet-stream".  Therefore,  I test in
my
> script for the Mac users and give them "Content-type:
application/downlaod"
> while I give other users "Content-Type: application/octet-stream".  Of
> course, this doesn't help the IE5.5 Mac users who still have to use
> "Downlaod Link to Disk" routine to get a save-as prompt.
>
> Anyone who sees different ways this could be done, please respond.
>
> Here's my code:
>
> if (eregi("mac",$HTTP_USER_AGENT))
>$type = "application/download";
> else
>$type = "application/octet-stream";
>
> // stream file to user
> header("Content-Type: $type");
> header("Content-Disposition: attachment; filename=$filename");
> header("Content-Length: ".filesize($tmp_file));
> header("Content-Transfer-Encoding: binary");
> readfile($tmp_file);
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: force download in IE -- conclusion

2001-08-22 Thread David Minor

I ran some tests of different header configurations of 6 browser/platform
combinations to find out what worked and what didn't.  I didn't cover all of
the platforms available, just those that my user-base uses, so this isn't
complete.  

combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7 for
Mac 9.1.  I tested all of these browsers using/not using 'attachment' in the
Content-Disposition header.  and also changed out the Content-Type header
with 'application/octet-stream', 'application/download', and '*/*'.

Here's the summary and what I did to make things work as well as possible.
My goal is to prompt the user with a save-as dialog for an mp3 file.

IE5.5 for Mac always uses the quicktime plugin to play the file no matter
what the disposition or type is.  (also no matter what the file extension
is.  Couldn't figure out how to trick it to download the file.)

IE5.5 for Win98 would attempt to download the file if ("content-disposition:
attachment; filename=") attachment was there.

All 3 of the Win98 browsers would do prompt with as few clicks as possible
when content-type was "application/octet-stream".  Therefore,  I test in my
script for the Mac users and give them "Content-type: application/downlaod"
while I give other users "Content-Type: application/octet-stream".  Of
course, this doesn't help the IE5.5 Mac users who still have to use
"Downlaod Link to Disk" routine to get a save-as prompt.

Anyone who sees different ways this could be done, please respond.

Here's my code:

if (eregi("mac",$HTTP_USER_AGENT))
   $type = "application/download";
else
   $type = "application/octet-stream";

// stream file to user
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Length: ".filesize($tmp_file));
header("Content-Transfer-Encoding: binary");
readfile($tmp_file);



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: force download in IE

2001-08-21 Thread Tim Frank

Some versions of IE will "sniff" the file to determine what type it is 
rather than taking your word for it that you REALLY want to download the 
file.  From my memory this is IE 4, and IE 5.5 where this is a problem.  
The way I dealt with this is to totally make up an application type that 
IE will not have a helper app for... such as "new/type" or whatever you 
want.  This should then trick IE into forcing a download.
The other trick I noted was that IE 5.5 doesn't like the "attachement" 
keyword in the Content-Disposition header.  Don't ask me why, all I know 
is that it won't pick up the supplied filename if you include it.
That is from my experiences in forcing download files and it seems to 
work out once you figure out every combination of what does/doesn't work 
for the various versions of IE.  Netscape is always fine, and I haven't 
tried any others extensively.

Fiddle with the various headers for the different IE browsers and you 
will get it to work.

Tim Frank

>> Original Message <<

On 20/08/01, 1:45:29 PM, [EMAIL PROTECTED] (David Minor) wrote regarding 
Re: force download in IE:


> on 8/20/01 12:07 PM, [EMAIL PROTECTED] wrote:

> This gave the same result:  it launches the helper app.

> Please help!!

> Regards.
> dm

> > Have you tried this?
> >
> > header("Content-Type: application/x-octet-stream");
> > header("Content-Description: MP3 file");
> >
> > David Minor wrote:
> >
> >> Can anybody tell me why this doesn't work in IE?  I need to force 
download
> >> mp3 files instead of IE5.5 trying to apply a helper app.  This code 
works
> >> fine for NN.
> >>
> >> // detect for MSIE bug
> >> if (strstr($HTTP_USER_AGENT, "MSIE"))
> >> $attachment = "";
> >> else
> >> $attachment = " attachment;";
> >>
> >> // stream file to user
> >> header("Content-Type: application/octet-stream");
> >> header("Content-Disposition:$attachment filename=$filename");
> >> header("Content-Length: ".filesize($tmp_file));
> >> header("Content-Transfer-Encoding: binary");
> >> readfile($tmp_file);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: force download in IE

2001-08-20 Thread David Minor

on 8/20/01 12:07 PM, [EMAIL PROTECTED] wrote:

This gave the same result:  it launches the helper app.

Please help!!

Regards.
dm

> Have you tried this?
> 
> header("Content-Type: application/x-octet-stream");
> header("Content-Description: MP3 file");
> 
> David Minor wrote:
> 
>> Can anybody tell me why this doesn't work in IE?  I need to force download
>> mp3 files instead of IE5.5 trying to apply a helper app.  This code works
>> fine for NN.
>> 
>> // detect for MSIE bug
>> if (strstr($HTTP_USER_AGENT, "MSIE"))
>> $attachment = "";
>> else
>> $attachment = " attachment;";
>> 
>> // stream file to user
>> header("Content-Type: application/octet-stream");
>> header("Content-Disposition:$attachment filename=$filename");
>> header("Content-Length: ".filesize($tmp_file));
>> header("Content-Transfer-Encoding: binary");
>> readfile($tmp_file);





[PHP] Re: force download in IE

2001-08-20 Thread bill

Have you tried this?

header("Content-Type: application/x-octet-stream");
header("Content-Description: MP3 file");

David Minor wrote:

> Can anybody tell me why this doesn't work in IE?  I need to force download
> mp3 files instead of IE5.5 trying to apply a helper app.  This code works
> fine for NN.
>
> // detect for MSIE bug
> if (strstr($HTTP_USER_AGENT, "MSIE"))
> $attachment = "";
> else
> $attachment = " attachment;";
>
> // stream file to user
> header("Content-Type: application/octet-stream");
> header("Content-Disposition:$attachment filename=$filename");
> header("Content-Length: ".filesize($tmp_file));
> header("Content-Transfer-Encoding: binary");
> readfile($tmp_file);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]