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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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