Re: IE5.5 Header Issues

From: Date: Thu, 04 Jan 2001 19:05:45 +0000
Subject: Re: IE5.5 Header Issues
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-32687@lists.php.net to get a copy of this message
Okay, I've finally gotten it to work in some situations, but I need some help understanding how to work around them or what may be causing them. Here they are: If I click on the link to the download script in the page I always get the download dialog for "index.html" regardless of filename. If I copy the link and paste it into a new window it gives me the download dialog for the proper "filename.ext". If I set the target to a new window and click the link on the page I also get the proper "filename.ext". If I copy the link and paste it into the window of the page holding the link I get the proper "filename.ext". Now for the catcher, once I have pasted the link into a window and downloaded the file any link to another file download through the download script continues to give me the download dialog for whatever "filename.ext" that was last downloaded. The filename for the dialog is not refreshed until I quit and restart the browser unless I copy and paste the link by hand again then this same scenario start over again. I have tried this with both "href=" and "href=javascript:location.href=". This also makes no difference. Calling the script like this: http://domain.com/download.php/filename.ext?filename=filename.ext gives no different results than this: http://domain.com/download.php?filename=filename.ext or this: http://domain.com/download.php?filename=filename.ext&other=value So the thing that is really bothering me is many people claim to have a version that works fine, only I haven't seen anyone else's examples work once yet. Could this be getting caused by something else? not PHP related? Also, if I am wrong and there are in fact versions out there that do work can you post some URL's using the download code? I've also noticed that the download links in the shared repository at phpbuilder.com do not work either. Thanks, Toby ----- Original Message ----- From: "Cynic" <cynic@mail.cz> To: "Toby Miller" <tmiller@creativegeneration.com>; <php-general@lists.php.net> Sent: Thursday, January 04, 2001 12:50 PM Subject: Re: [PHP] IE5.5 Header Issues > "Connection: close" just means the server won't keep the > connection alive after sending the content. > > > At 18:30 4.1. 2001, Toby Miller wrote the following: > -------------------------------------------------------------- > >Allright, some new information. I pulled down just the headers that are > >being passed back from my file download and here are the results I received. > > > >HTTP/1.1 200 OK > >Date: Thu, 04 Jan 2001 17:08:23 GMT > >Server: Apache-AdvancedExtranetServer/1.3.12 (NetRevolution/Linux-Mandrake) > >PHP/3.0.16 mod_perl/1.22 > >X-Powered-By: PHP/3.0.16 > >Content-Disposition: attachment; filename=Resource Phonelist.pdf > >Content-Description: Issue Tracker Download > >Content-Length: 29334 > >Connection: close > >Content-Type: application/pdf > > > >The one thing that doesn't look quite right to me is the fact that > >"Connection: close" is before "Content-Type: application/pdf". Does anyone > >know if this is correct? Since PHP can't set the order of the headers being > >sent, could this be a problem with Apache sending the close command too > >soon? Can anyone shed some light on this for me? > > > >Thanks, > >Toby > > > > > >----- Original Message ----- > >From: "Toby Miller" <tmiller@creativegeneration.com> > >To: <php-general@lists.php.net> > >Sent: Wednesday, January 03, 2001 3:10 PM > >Subject: Re: [PHP] IE5.5 Header Issues > > > > > >> Hey all, > >> > >> I am completely stumped now. I've tried everyone's suggestions and it > >still > >> doesn't work in IE. However, every suggestion works fine in Netscape. Here > >> is the code I started with: > >> > >> <?php > >> > >> if (isset($source) && isset($filename)) { > >> if (filetype($source) == "text/plain") header("Content-Type: > >> text/plain"); > >> else header("Content-Type: application/octet-stream"); > >> header("Content-Disposition: attachment; filename=$filename"); > >> header("Content-Length: ".filesize($source)); > >> readfile($source); > >> exit(); > >> } > >> > >> ?> > >> > >> I then tried this code: > >> > >> <?php > >> > >> if (isset($source) && isset($filename)) { > >> header("Content-Type: ".filetype($source)); > >> header("Content-Disposition: attachment; filename=$filename"); > >> header("Content-Length: ".filesize($source)); > >> readfile($source); > >> exit(); > >> } > >> > >> I've also tried this code: > >> > >> <?php > >> > >> if (isset($source) && isset($filename)) { > >> header("Content-Type: application/octet-stream"); > >> header("Content-Disposition: attachment; filename=$filename"); > >> header("Content-Length: ".filesize($source)); > >> readfile($source); > >> exit(); > >> } > >> > >> ?> > >> > >> The actual URL I'm sending looks like this: > >> > >> > >http://www.domain.com/download.popup.php/filename.ext?source=%2Fwww%2Fclien t > >> 2%2Ffiles%2Factualfilename.ext&filename=filename.ext > >> > >> I am running this on Apache Linux. I am testing with IE5.5. I get the > >> download dialog every time, which asks if I want to save the file as the > >> filename "index.html". I have tried every suggestion that has been given > >to > >> no avail. I don't know what element I'm missing. If someone has some > >actual > >> code that works for this situation it might shed some light on what I'm > >> doing wrong. I would just use an actual download link, but some of the > >files > >> that will be downloaded through this method in the future will be > >generated > >> on the fly and the issue will surely come back to haunt me. I really > >> appreciate the help guys. > >> > >> Thanks, > >> Toby > >> > >> ----- Original Message ----- > >> From: "jeremy brand" <jeremy@nirvani.net> > >> To: "Philip Hallstrom" <philip@oddjob.adhesivemedia.com> > >> Cc: <tmiller@creativegeneration.com>; <php-general@lists.php.net> > >> Sent: Wednesday, January 03, 2001 1:43 PM > >> Subject: Re: [PHP] IE5.5 Header Issues > >> > >> > >> > > /normal/path/to/url?foo=bar&fake=filename.ext > >> > > > >> > > ? It might trick IE into thinking that the filename it should be > >saved > >> > > as is "filename.ext" > >> > > >> > I can verify that if IE notices the .ext it will try and handle it > >> > ignoring any mime types that you bothered to set. > >> > > >> > > Or if you can use PATH_INFO instead of a query string and do something > >> > > like this: > >> > > > >> > > /normal/path/to/phpfile.php/filename.ext > >> > > > >> > > That would then set PATH_INFO equal to "/filename.ext" > >> > > > >> > > I don't see how IE would know not to save it as filename.ext in this > >> > > case. (you'd think anyway :) > >> > > >> > There is supposadly a work around. I saw it fly by the list about 3 > >> > weeks ago. It is a custom Content-type: header that IE understands > >> > that has a recommended filename accociated with it. It is not in any > >> > HTTP RFC, but I think it is possibly part of another one. > >> > > >> > I don't have time to dig it up, but the answer is out there, try > >> > searching the list archives. > >> > > >> > Jeremy > >> > > >> > Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: > >> jeremy@nirvani.net > >> > > >> > http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more > >> > Get your own Free, Private email at > >> > http://www.smackdown.com/ > >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > >> > "<body>" -- Quoted from Yahoo! homepage, > >> > http://www.yahoo.com > >> > > >> > > > >> > > -philip > >> > > > >> > > In article <00a401c0759f$6c623840$13011eac@tmiller> you write: > >> > > >I do want it to prompt the user to download I just want it to prompt > >> the > >> > > >user with the filename that's specified, not "index.html" > >> > > >for every > >> > > >requested download. It works in Netscape 4 and 6, but not in IE5. > >I've > >> also > >> > > >tested it now in IE4, but that doesn't really count since Microsoft > >has > >> > > >already announced that it won't work properly there, but they claim > >> that it > >> > > >does in IE5. Any other suggestions? > >> > > > > >> > > >----- Original Message ----- > >> > > >From: "Blaster" <blaster@videotron.ca> > >> > > >To: "Toby Miller" <tmiller@creativegeneration.com>; > >> > > ><php-general@lists.php.net> > >> > > >Sent: Wednesday, January 03, 2001 9:30 AM > >> > > >Subject: RE: [PHP] IE5.5 Header Issues > >> > > > > >> > > > > >> > > >> The line: > >> > > >> header("Content-Disposition: attachment; filename=$filename"); > >> > > >> is to prompt the browser to download the file... So if you > >> > > >> don't > >want > >> the > >> > > >> browser to prompt for a file download, don't put it > >> > > >> > >> > > >> -----Original Message----- > >> > > >> From: Toby Miller [mailto:tmiller@creativegeneration.com] > >> > > >> Sent: Wednesday, January 03, 2001 09:19 > >> > > >> To: php-general@lists.php.net > >> > > >> Subject: [PHP] IE5.5 Header Issues > >> > > >> > >> > > >> > >> > > >> I am using the following code: > >> > > >> > >> > > >> <?php > >> > > >> > >> > > >> if (isset($source) && isset($filename)) { > >> > > >> if (filetype($source) == "text/plain") > >> > > >> header("Content-Type: > >> > > >> text/plain"); > >> > > >> else header("Content-Type: > >> > > >> application/octet-stream"); > >> > > >> > >> > > >> header("Content-Disposition: attachment; filename=$filename"); > >> > > >> header("Content-Length: ".filesize($source)); > >> > > >> readfile($source); > >> > > >> exit(); > >> > > >> } > >> > > >> > >> > > >> ?> > >> > > >> > >> > > >> This does not work properly in IE 5.5. I don't have another version > >> of IE > >> > > >to > >> > > >> test this with. I get a save dialog box for the file "index.html" > >> every > >> > > >> time. This is the same for all file types. Is this just a bug in IE > >> 5.5 or > >> > > >> is this the same in other versions of IE? If anyone knows the > >> workaround I > >> > > >> would love to see it. > >> > > >> > >> > > >> Thanks, > >> > > >> Toby > >> > > >> > >> > > >> > >> > > >> > >> > > >> -- > >> > > >> PHP General Mailing List (http://www.php.net/) > >> > > >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >> > > >> For additional commands, e-mail: php-general-help@lists.php.net > >> > > >> To contact the list administrators, e-mail: > >> php-list-admin@lists.php.net > >> > > > > >> > > > > >> > > >-- > >> > > >PHP General Mailing List (http://www.php.net/) > >> > > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >> > > >For additional commands, e-mail: php-general-help@lists.php.net > >> > > >To contact the list administrators, e-mail: > >> php-list-admin@lists.php.net > >> > > > > >> > > > >> > > > >> > > > >> > > -- > >> > > PHP General Mailing List (http://www.php.net/) > >> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >> > > For additional commands, e-mail: php-general-help@lists.php.net > >> > > To contact the list administrators, e-mail: > >php-list-admin@lists.php.net > >> > > > >> > > > >> > > >> > > >> > -- > >> > PHP General Mailing List (http://www.php.net/) > >> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >> > For additional commands, e-mail: php-general-help@lists.php.net > >> > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >> > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >> For additional commands, e-mail: php-general-help@lists.php.net > >> To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > ------end of quote------ > > > > ____________________________________________________________ > Cynic: > > A member of a group of ancient Greek philosophers who taught > that virtue constitutes happiness and that self control is > the essential part of virtue. > > cynic@mail.cz > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#32687) next »