Jump to content

Uploading Binary, Outputting Corrupted Data


PowerDrift

Recommended Posts

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.
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.