file download through php



I have a problem when doing indirect download of file through php, when
I click on download link Firefox and Internet Explorer give me same
options: Open and Save. Firefox opens file directly from Internet and
downloads without problem.

Internet Explorer saves file on local disk and I can open it from disk
correctly but when I try to open it directly from Internet it responds
with "There was an error opening this document. This file cannot be
found.", concrete situation in my usage is Pdf document. Below is my
concrete code, any suggestions are appreciated.


<?php
ob_start();
include_once("config.php");
ini_set('display_errors', 'Off');
error_reporting(0);

$args = trim($_SERVER["PATH_INFO"]);
$args = preg_replace("/^\//i", '', $args);
$argv = explode('/', $args);
$id = (int)$argv[0];

import('dao.fm.file');
$f = fm_file::instance($id);

if($f->get('id') < 1) {
die('No file.');
}
header('Content-Disposition: attachment');
header('Accept-Charset: UTF-8');
header('Content-Type: '.$f->get('type').'; charset="UTF-8";');
readfile(get('FILES').'/'.$f->get('id'));
ob_end_flush();
?>

.



Relevant Pages

  • Re: How to make IE accept it is NOT the default browser?
    ... How to configure Internet Explorer to open Office documents in the appropriate Office program instead of in Internet Explorer: ... Note that .CSV also opens with Excel. ... Also other users download this file successfully using IE6. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: file download through php
    ... I click on download link Firefox and Internet Explorer give me same ... Firefox opens file directly from Internet and ... Internet Explorer saves file on local disk and I can open it from disk ...
    (comp.lang.php)
  • Re: file download through php
    ... I click on download link Firefox and Internet Explorer give me same ... Firefox opens file directly from Internet and ... Internet Explorer saves file on local disk and I can open it from disk ...
    (comp.lang.php)
  • Add/Remove Programs not working
    ... I have solved Add/remove programs problem uninstalling ... and it never opens. ... >My second problem is with Internet Explorer. ... >asks if I want to download yahoo.com as an html file, ...
    (microsoft.public.win2000.applications)
  • Add/Remove Programs not working
    ... panel, I get the hour glass like it's trying to open, and ... and it never opens. ... My second problem is with Internet Explorer. ... asks if I want to download yahoo.com as an html file, ...
    (microsoft.public.win2000.applications)