1

I have an html form. Inside of that form there is an input with type="file" and accept="image/*". When the form gets submitted the value of the input is saved to a php variable.

How can I get blob of the uploaded image using php? I only need to get the blob of the image so I can store it to a database. I can do everything else necessary for uploading the file.

I have looked at Quick php file upload guide and none of the answers there helped me.

Community
  • 1
  • 1
gw90
  • 97
  • 1
  • 8
  • @TiesonT. this is not a duplicate because this is asking a specific question about how to get something done. That was asking for a tutorial. – gw90 Mar 22 '15 at 17:44

2 Answers2

0

Replace 'uploadfieldname' with the actual name of the upload field

echo file_get_contents($_FILES['uploadfieldname']['tmp_name'])
-1

You have a similar question if i am not wrong: https://stackoverflow.com/a/17122270

$directory = "mytheme/images/myimages";
$images = glob($directory . "*.jpg");

foreach($images as $image)
{
  echo $image;
}
Community
  • 1
  • 1
tam
  • 352
  • 1
  • 3
  • 13
  • Well, this doesn't actually get the blob of the image. This is not the kind of answer that I was looking for. – gw90 Mar 22 '15 at 17:41