Q:

Uploaded image not being stored properly in the database (php mysql)

I am trying to store uploaded images in the database. However, the images won't display, and when i take a look at the table with phpmyadmin in the image column i see stuff like [BLOB - 20B] instead of the actual size it should have.
The display script works fine, as i inserted an image through phpmyadmin instead of my upload script and it displayed fine.
My form:
<form id="productForm" action="index.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="product_id" value="' . $values['product_id'] . '" />
<input type="file" name="image" />
</form>

Processing code:
$clean['image'] = mysqli_real_escape_string($dbc, file_get_contents($_FILES['image']['tmp_name']));

mysqli_query($dbc, "
  INSERT INTO product_images (product_id, mime, image)
  VALUES ('{$clean['last_product_id']}', '{$clean['mime']}', '{$clean['image']}')
");

I have omitted everything that is irrelevant cause the other things seem to be working well.
Thanks

A:

Apparently it had something to do with the escaping. I ended up not escaping anything until the actual query, which i formed with sprintf()
$clean['qText'] = sprintf("
  INSERT INTO product_images (product_id, mime, image)
  VALUES ('%d', '%s', '%s')",

  mysqli_real_escape_string($dbc, $clean['last_product_id']),
  mysqli_real_escape_string($dbc, $clean['mime']),
  mysqli_real_escape_string($dbc, file_get_contents($_FILES['image']['tmp_name']))
);

mysqli_query($dbc, $clean['qText']);

