title: How to send a file from html page using ajax to php which in turn stores in mysql database in column of type BLOB?
body: <p>I have an HTML5 page that allows user to update his website, email and profile pic. Updating Website/email is not a problem for me that works.</p>
  
  <p>However i want to know how can i send an image from the html input element to php file using ajax which in-turn stores that in MySql table which has a column of the type BLOB. </p>
  
  <p>I have pasted my code below please advise is this correct?</p>
  
  <p>1)HTML File</p>
  
  <pre><code>    &lt;label for="website"&gt;Website&lt;/label&gt;
      &lt;input type="text" name="website" id="website" data-clear-btn="true"&gt;
  
  
      &lt;label for="email"&gt;Email&lt;/label&gt;
      &lt;input type="email" name="email" id="email" data-clear-btn="true"&gt;
  
  
  
      &lt;label for="uploadimg" class="ui-hidden-accessible"&gt;Upload Image of Advertisement:&lt;/label&gt;
      &lt;input type="file" name="uploadimg" id="uploadimg" placeholder="Upload Image of Advertisement.."&gt;
  
  
      &lt;input type="submit" value="Update Profile" onclick="updateUserProfile()"&gt;
  </code></pre>
  
  <p>2)Javascript File</p>
  
  <pre><code>function updateUserProfile(){
  
  var website=document.getElementById("website").value;
  var email=document.getElementById("email").value;
  var image=document.getElementById("uploadimg").value;
  
  $.post("php/updateUserProfile.php",
    {
      website:website,
      email:email,
      image:image
    });
  
  }
  </code></pre>
  
  <p>3) PHP File</p>
  
  <pre><code>$website = $_POST['website'];
  $email= $_POST['email'];
  $image= $_POST['image'];
  
  mysqli_query($con,"UPDATE profileinformation SET Website='".trim($website)."', Image ='".($image)."'  Where email='".$email."' ");
  </code></pre>