Here is my sample jQuery coding that I used for passing my image to php using AJAX.
HTML input
<input id="forkliftImagePath" name="image" type="file" />
admin_forklift_detail.php
$.ajax({
type: "POST",
url: "../Client/php/add_forklift_detail_process.php",
data: str,
cache: false,
contentType: false,
processData: false,
async: false,
success: function(msg) {
alert(msg);
}
})
here is another php file that execute the code that pass from AJAX.In this file will get the image name and pass back to "admin_forklift_detail.php" for alert purpose.
add_forklift_detail_process.php
<?php
$name = $_FILES['image']['name'];
echo $name;
?>