Jump to content


Photo

Uploading Binary, Outputting Corrupted Data


  • Please log in to reply
1 reply to this topic

#1 PowerDrift

PowerDrift
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 January 2006 - 06:04 AM

I'm having this problem when I upload binary data to a MySQL table. When I upload an image, the results is a corrupted image (which can be seen here: [a href=\"http://americanmachineryhawaii.com/agriculture/equipmentdb/index.php?id=10036)\" target=\"_blank\"]http://americanmachineryhawaii.com/agricul...x.php?id=10036)[/a]. The weird this is that I uploaded this image before I uploaded the image that was supposed to be shown (instead of the corrupted file). Do you know what is causing this and how to fix it? I have tried dropping the table and recreating it, and dropping the database and recreating it. I also tried "FLUSH", but nothing happened.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 18 January 2006 - 02:47 PM

Well, first, it has nothing to do with the table or the database. You've obviously managed to corrupt the binary data itself, though not terribly, because it still looks image-like. My guess is that you used the addslashes() function which can destory binary uploads. Post _just_ the relevant section of your PHP script that actually processes the image upload and inserts the data into your table.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users