word document is not correct after downloaded

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • h3ctor83
    New Member
    • Apr 2007
    • 1

    word document is not correct after downloaded

    hello everyone.. can anybody help me?
    i made an application to upload files to the server..
    and after that use ris able to download that file again..
    but after downloading the file (specifically word document), i found that the content is not correct..

    lets say the original content is "This is a word document"..afte r downloading the file..the content becomes "&@%&*@**)@!)(! @)((___@!#" (some invalid unreadable characters)..
    what cause this error? i also cannot view a jpeg document after downloading it..

    here's the script for my download.php :

    <?
    ob_start();
    session_start() ;

    include 'config.php';
    include 'opendb.php';

    $query = "SELECT * FROM phpgw_dts_attac hment WHERE att_id = ".$_REQUEST['att_id'];
    $result = mysql_query($qu ery, $db);

    if ($result){
    while($row = mysql_fetch_arr ay($result))
    {
    $att_name = $row['att_name'];
    $att_path = $row['att_path'];
    $location = $att_path.$row['att_tempname'];
    $att_type = $row['att_type'];
    }
    }
    header('Content-Disposition: attachment; filename="'.$at t_name.'"');
    header("Cache-Control: must-revalidate");
    header("Content-Type: ".$att_type );
    readfile($locat ion);

    //ini_set('zlib.o utput_compressi on','Off');

    exit();
    ?>

    can anyone help me with this?
  • mihai123
    New Member
    • Mar 2007
    • 13

    #2
    hmmm

    if you try to view in browser the word it's normal to see that caracter
    download the file and open it with microsoft word.
    header("Content-Type: application/octet-stream");

    Note: i see that you user a blob to store the file. Maybe the blob it's to small i notice from my experience that a program manager for database can create only blob with small storage capability. It's useful to manually create the blob colum by using a php script.

    Comment

    Working...