Connecting Tech Pros Worldwide Help | Site Map

word document is not correct after downloaded

Newbie
 
Join Date: Apr 2007
Posts: 1
#1: Apr 12 '07
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"..after 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_attachment WHERE att_id = ".$_REQUEST['att_id'];
$result = mysql_query($query, $db);

if ($result){
while($row = mysql_fetch_array($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="'.$att_name.'"');
header("Cache-Control: must-revalidate");
header("Content-Type: ".$att_type);
readfile($location);

//ini_set('zlib.output_compression','Off');

exit();
?>

can anyone help me with this?
Newbie
 
Join Date: Mar 2007
Posts: 13
#2: Apr 12 '07

re: word document is not correct after downloaded


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.
Reply