I cant able to direcly open file in IE(force download)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abureach
    New Member
    • Aug 2006
    • 1

    I cant able to direcly open file in IE(force download)

    Hi,

    I cant able to direcly open the file in IE(force download)
    the follwing code is not working in IE.
    Please help me

    my coding is


    if(ini_get('zli b.output_compre ssion'))
    ini_set('zlib.o utput_compressi on', 'Off');

    header("Pragma: public"); // required
    header("Expires : 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false) ;
    header("Content-Type: image/jpg");
    header("Content-Disposition: attachment; filename=".base name($filename) .";" );
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($fil ename));
    readfile("$file name");
    exit();

    or

    header("Pragma: public");
    header("Expires : 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false) ;
    header("Content-Type: $etype");
    header("Content-Disposition: attachment; filename=\"$fil ename\"");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($fil ename));
    readfile("$file name");
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    PHP is server side script, it is not going to work in any browser, it is run by the web-server.

    Comment

    Working...