Hi,
I'm Trying to upload and display images stored in an innoDB table (BLOB Type)
I can do it with on a MYISAM table, but I tried to do it with on an INNODB table, and it doesn't work!
Here's the PHP code I use to display the image :
<code>
... database connection and recordset ...
header("Pragma: no-cache");
header("Content-type: " . $row_rsBlob['logoType']); // image/gif
echo (($row_rsBlob['logo'])); // the binary data
</code>
I get the following message (Firefox) : The image "http://www.mydomain.com/displayImage.php" could not be displayed because it contains errors (translated from french)
Of course, I'v tried with several images and (I repeat), I'v already done it on a MYISAM table (the only difference I noticed) and it was OK
Here's the PHP code and SQL query I use to upload the file in the database:
<code>
...
$id = $_GET['id'];
$myImgData = addslashes(fread(fopen($formFile, "rb"), filesize($formFile)));
$updateSQL = "UPDATE myTable SET myTable.logo='$myImgData', myTable.logoType='$formFile_type' WHERE id=".$id;
...
</code>
Thanks for your help, I'm loosing time and the deadline is coming soon...
Upload and display images stored in innoDB table (BLOB Type)
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
When you get
View the source and see if there aren't any error or extra characters at the start.FireFox wrote:The image "http://www.mydomain.com/displayImage.php" could not be displayed because it contains errors