I am devlop the ticket concept project.I create upload attachement option in add new ticket.
I am store the attachement files in the database.(datatype longblob).
When show the ticket there is a option for download attachements.
When I download the notepad files it is show the content.
The other format not download properly.
Download file coding is
Code: Select all
<?
$post_id=$_GET['id'];
$sql=mysql_query("select * from posts_text where post_id=$post_id");
$row=mysql_fetch_array($sql);
$content = $row['content'];
@ob_end_clean();
# Make sure that IE can download the attachments under https.
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: ' . $row['filetype'] );
header( 'Content-Length: ' .$row['filesize'] );
# Added Quotes (") around file name.
header( 'Content-Disposition: attachment; filename="' . $row['filename'] . '"' );
header( 'Content-Description: Download Data' );
header( 'Pragma: no-cache' );
header( 'Content-Transfer-Encoding: binary' );
readfile( $content );
?>The download word file show content
<br />
<b>Warning</b>: readfile(ÐÏ à¡± á): failed to open stream: Invalid argument in
<b>download.php</b> on line <b>33</b><br />
Anybody know what is the error?
Thanking you.