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&hl=en&rlz=&q=php+download+file+internet+explorer+headers&meta
=


Relevant Pages

  • Re: Downloading videos
    ... Once you have downloaded and installed firefox, ... These can capture any flash footage - any site not just youtube. ... and add to favorites in Internet Explorer: ...
    (microsoft.public.windowsxp.video)
  • Re: firstNode problems
    ... > What it should do (and indeed, what it does do, in Internet Explorer) ... In Firefox, however, it shows a black box. ... handles these spaces as firstChild, ...
    (comp.lang.javascript)
  • Re: Security bar
    ... I've had that problem since I downloaded Internet ... I suppose we should assume Windows XP with Service ... Download, install, run, update and perform a full scan with the ... Close all Internet Explorer windows and other applications. ...
    (microsoft.public.windowsupdate)
  • Re: Install Internet Explorer 7 now
    ... Andy you should be able to call JUNO from Firefox without Juno's software. ... I have to use "Explorer" to get on the internet, ... that makes a computer on the internet vulnerable to mischief.... ... But that you did make that other posting and some of your ...
    (soc.retirement)
  • Re: Internet slowed way down
    ... >> Firefox browser, just as slow. ... >> normal speed on the internet. ... > Alternative download pages for Ad-Aware, Spybot, HijackThis and CWShredder ...
    (microsoft.public.windowsxp.general)