title: Upload picture with MySQL PDO
body: <p>I need to upload a picture to my db and im insecure in how to do this properly. I'm using MySQL and PDO</p>
  
  <p>I upload the file through a simple HTML input which links to this PHP file</p>
  
  <pre><code>$image =addslashes(file_get_contents($_FILES['image']['tmp_name'])); //Extract the content of image
  $imageProperties = getimageSize($_FILES['image']['tmp_name']); //Extract the mime type (filetype)
  
  $loggedinuser=$_SESSION["ID"];
  
  $sql = "UPDATE UserProfile SET profilePicture=:image, pictureFileType=:imageProperties WHERE UID=:loggedinuser";
  
  // $imageProperties['mine'] value
  // $image value
  
   try {
    $st = $conn-&gt;prepare($sql);
    $st-&gt;bindParam(":loggedinuser",$_SESSION["ID"], PDO::PARAM_STR);
  
    $st-&gt;execute();
    $rows=$st-&gt;fetchAll();
   } catch (PDOException $e) {
    echo "Server Error - try again";
    exit;
   }; 
  </code></pre>
  
  <p>I dont know how to bind the values or parameter for the picture and filetype.
  Any help would be appreciated</p>