RE: [PHP] Downloading a file



Thanks, that did the trick. I'd done a google search before but didn't come
up with any answers but hadn't added headers to the search phrase.



In case anyone is interested in the solution, my script included
session_start and I found that by adding session_cache_limiter("none")
before session_start resolved the problem
(http://bytes.com/forum/thread554529.html)



Robbert



From: Tom Chubb [mailto:tomchubb@xxxxxxxxx]
Sent: Wednesday, July 16, 2008 1:41 AM
To: Robbert van Andel
Cc: php-general@xxxxxxxxxxxxx
Subject: Re: [PHP] Downloading a file



On 16/07/2008, Robbert van Andel <robbert@xxxxxxxxx> wrote:

I am having trouble getting a file to download to work in Internet Explorer.
The site works fine in FireFox. The page retrieves the contents of a file
from a database and outputs the following



<?PHP



header("Content-type: application/octet-stream");

header("Content-Disposition: attachment; filename=\"{$data['filename']}\"");

header("Content-Description: PHP Generated Data");

echo $data['file'];



?>



Where $data['filename'] is the name of the file as stored in the database
and $data['file'] is the contents of the file. The script used to download
the file is called view.php. As I mentioned, this works great in FireFox
but with Internet Explorer, I get the following error:



Internet Explorer cannot download view.php from www.yourdomain.com.



Internet Explorer was not able to open this Internet site. The requested
site is either unavailable or cannot be found. Please try again later.



Any help would be greatly appreciated.



Robbert


Start here:

http://www.google.co.uk/search?source=ig
<http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=php+download+file+int
ernet+explorer+headers&meta>
&hl=en&rlz=&q=php+download+file+internet+explorer+headers&meta=



Relevant Pages

  • Downloading a file
    ... I am having trouble getting a file to download to work in Internet Explorer. ... Where $datais the name of the file as stored in the database ... this works great in FireFox ...
    (php.general)
  • Re: Zip Code Table
    ... Q. Where can I get a database or directory of all ZIP Codes and/or ZIP+4 ... The information you are seeking is not available via download but is ... You can do a Google search for other sources, but I doubt you'd find any ...
    (microsoft.public.access.gettingstarted)
  • Re: Unable to start Internet Explorer or Windows Explorer
    ... As you can not download these programs from the Internet, if your PC has CD read capabilities, go to another computer with CD-ROM burning capabilities. ... Copy the HOLD folder to the hdard drive of the infected machine, then install the programs in the HOLD folder and run them. ... CastleCops HiJackThis Forum ... will pop up saying "Internet Explorer has encountered a problem and must ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: mshtml.dll Error! (Win XP SP2)
    ... internet explorer executable is iexplore.exe. ... serious problem on your hands - you have a virus or severe spyware infection. ... You can download BHOcop, and view an introduction to it, ... I've tried EVERYTHING to fix this problem. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Download Failure Problem in IE 6
    ... I am experiencing a strange Internet Explorer error on my desktop box that I ... occurring when I attempt to download a zip file ... This error has occurred on multiple web sites, ... Error message text: “Internet Explorer cannot download ...
    (microsoft.public.windows.inetexplorer.ie6.browser)