Files don't show on Windows/MSIE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee Mahan

    Files don't show on Windows/MSIE

    I am attempting to download files (usually images) for viewing with
    either the user's browser or a program associated with the file type.
    Unfortunately, this requires that it works in MSIE (works ok with
    Mozilla and Opera) but when I attempt to use MSIE it offers a choice
    of either opening it or saving.

    Opening the message, causes the image viewing program to state that
    the file is not a valid jpeg (I'm using jpegs for testing presently).
    And when I select "Save", nothing is downloaded.

    I'm already losing my hair, so please save the hair!

    The afflected code:

    header("Content-type: " .
    $row['mime_type']);
    header("Content-length: " . $row['size']);
    header("Content-Disposition:
    attachment;file name=" . $row['filename']);
    header("Pragma: no-cache");
    header("Expires : 0");
    $fa = fopen("/tmp/attach/" . $row['id'],"rb");
    $buffer = fread ($fa, $row['size']);
    echo $buffer;

    I've also tried:

    $fa = fopen("/tmp/attach/" . $row['id'],"rb");
    echo fread ($fa, $row['size']);
    fpassthru($fa)
    or die("Unable to read file!");


    Thanx

    *************** *************** ******
    This is the final test of a gentleman: His respect for
    those who can be of no possible service to him.

    --William Lyon Phelps, American educator (1865-1943).
    *************** *************** *********
    --Lee
    Design West
    Chief Technology Officer
    ACM Member
    Computer Society Member
    Usenix & SAGE

Working...