I've been trying to pass an image from ajax to PHP from a file upload in the form.
The following is my ajax call:
var dataString = 'city='+ city_push + '&venue=' + venue_push + '&title=' + title_push + '&subtitle=' + subtitle_push + '&date=' + date_push + '&time=' + time_push + '&price=' + price_push + '&description=' + description_push + '&tag1=' + tag1_push + '&tag2=' + tag2_push + '&email=' + email_push + '&newvenue=' + newvenue + '&password=' + password_push;
$.ajax({
type: "POST",
url: "assets/new.php",
data: dataString,
success: function() {
alert("success");
}
});
return false;
I want to add to my dataString the file so I can process it in the PHP file with $_FILES. Is there a way to do this and maintain the current structure? This ajax code is being called on a successful form submit.
Thanks for your help!