I have several other identical functions working successfully but I can not get this last bit to work (The photo being 'uploaded' is not storing in the database). Any help at all would be much appreciated. I understand the mysql statements are a deprecated version and will be changed.

Ajax function

function uploadProLicense5() { var ajax = new XMLHttpRequest(); var dataFive = new FormData(); dataFive.append("professionalLicensePhotoFifthProivder", document.querySelector("#professionalLicensePhotoFifthProivder").files[0]); ajax.open("POST", "home.php"); ajax.onreadystatechange = function() { if (ajax.readyState === 4) { if (ajax.status === 200) { // OK $('#success_prolicense5').fadeIn().html("Photo Saved"); setTimeout(function(){ $('#success_prolicense5').fadeOut("Slow"); }, 2000); // here you can use the result (ajax.responseText) } else { // not OK alert('failed to upload photo, please try again'); } } }; ajax.send(dataFive); }

Html

<div class="well col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-4 col-sm-10 col-sm-offset-1 col-xs-10 col-xs-offset-1" id="professionalphotoRow5"> <div class="text-center"> <label>Upload professional license photo:</label> </div> <div class="text-center"> <label id="label5thproviderPro">for 5th provider</label> </div> <div class="col-sm-offset-4 col-xs-offset-4"> <input name="professionalLicensePhotoFifthProivder" id="professionalLicensePhotoFifthProivder" class="filestyle" data-input="false" type="file" accept="image/*"> </div> <?php $savedTxt = "Photo Saved"; $notSavedTxt = "Photo Not Saved"; if (!empty($userRow[pro_license_photo_provider_five])) { echo "<i class='glyphicon glyphicon-ok col-sm-offset-4 col-xs-offset-4' style='color: greenyellow;'>" . "</i> " . $savedTxt; } ?> <br> <div class="col-sm-offset-4 col-xs-offset-4"> <input id="saveProfessionalPhoto5" type="button" class="btn btn-default" name="saveProfessionalPhoto5" onclick="uploadProLicense5()" value="upload photo" style="background-color: #1d2b5c; color: white"/> </div> <span id="success_prolicense5" class="text-success col-sm-offset-4 col-xs-offset-4"></span> </div>

PHP

$db_pro_license_img_provider_five = addslashes(file_get_contents($_FILES['professionalLicensePhotoFifthProivder']['tmp_name'])); $pro_image_data_provider_five = base64_encode($userRow[pro_license_photo_provider_five]); $pro_data_provider_five = substr($pro_image_data_provider_five, strpos($pro_image_data_provider_five, ",")); if(!empty($db_pro_license_img_provider_five)){ $sql = "UPDATE `wp_form` SET `pro_license_photo_provider_five`='$db_pro_license_img_provider_five' WHERE id =" . $_SESSION['user']; mysql_query($sql) or die(mysql_error()); $res = mysql_query("SELECT * FROM wp_form WHERE id=" . $_SESSION['user']); $userRow = mysql_fetch_array($res); }

Here's my network request

And then my empty blob : (