Please I am having problem downloading pdf (Acrobat reader) files that
I uploaded in mysql database.
The file downloads but it does not embed the pdf file in the browser.
Instead, it opens the pdf file and make the current page blank
Below is the file download code. Pls help me
<?php
$db_name = "database_name";
$table_name = "books_table";
$connection = mysql_connect("localhost", "username", "password") or
die("couldn't connect.");
$db = mysql_select_db($db_name, $connection) or die("couldn't select.");
$chk_file = "
SELECT file_browse
FROM $table_name
WHERE book_isbn = \"$_GET[book_isbn]\"
";
$chk_file_res = mysql_query($chk_file,$connection) or die("couldn't
connect.");
$chk_file_num = mysql_num_rows($chk_file_res);
if ($chk_file_num == "0")
{
header("Location: http://www.url.com/books/books.php");
exit;
}
else
{
$sql = "
SELECT name, type, size, file_browse
FROM $table_name
WHERE book_isbn = \"$_GET[book_isbn]\"
";
$query = mysql_query($sql,$connection) or die("couldn't connect.");
$filename = mysql_result( $query, 0, 0 );
$filetype = mysql_result( $query, 0, 1 );
$filesize = mysql_result( $query, 0, 2 );
$file_browse = mysql_result( $query, 0, 3 );
header( "Content -type: $filetype" );
header( "Content -length: $filesize" );
header( "Content -Disposition: attachment; name=$filename" );
header( "Content -Description: From Crawford University Library" );
echo $file_browse;
}
?>
Thanks
Damelinks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---