I'm using javascript's 'formData' to send image files with ajax. How can I attach other data to formData, for example a text string?
JS:
$("#post-image").click(function(){
$.ajax({
url: "../../build/ajaxes/upload-photo.php",
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (response) {
console.log(response);
}
});
});
PHP:
In my PHP I can access the image by using $_FILES["images"]
. I don't know what to use for my additional data passed with formdata.