473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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"..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?
Apr 12 '07 #1
1 1392
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.
Apr 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Microsoft | last post by:
I'm trying to display a word document inside a web page, but everytime I do I get this error: Error Type: Microsoft VBScript runtime (0x800A0046) Permission denied: 'CreateObject' Does...
20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
0
by: Chris J | last post by:
Hi all, ] I'm having a problem with Word 2002 when downloading a Word document with IE6. This is in an intranet application, and the download occurs through an ASP that does security checks...
1
by: Jonas | last post by:
Hi ! Perhaps this isn't the right group to send to, but... I have exported my report (Crystal Report) to a stream formatted as Word-document. Both the exporting and streaming works just fine...
12
by: Rob Nicholson | last post by:
We've implemented functionality to allow a user to download a document (any document type) from the IIS server using the following code: Response.Clear() Response.ContentType =...
16
by: Simon Verona | last post by:
I have a problem with automating MS Word through vb.net My code is : Dim objword As new Word.ApplicationClass Try objWord.Documents.Open(letterfile)...
0
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I am creating a webpage and opening it as a Word document. Problem is that as I create one of the questions, some of the text is not appearing in the document as it should. As I step through it, I...
1
by: Taras_96 | last post by:
Hi everyone, I'm using PHP and a DB to control access to files that have been uploaded by users. I am using the following PHP code snippet to deliver the file after the access rights have been...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.