Can one help me how i can upload files with JQuery, am using JQuery to submit form where a user is allowed to enter some data in the text-area and also attach image file to the note so i have a problem that the form is not able to upload the file but only the text and timestamp of the uploaded image. is there anyone know how i can do this
JQuery
$(document).ready(function() {
$("#statusForm").submit(function() {
var frm = $('#statusForm');
$.ajax({
type: frm.attr('method'),
url: 'tweet.php',
data: frm.serialize(),
success: function (data) {
$('#new_tweet').html(data);
$('#txtArea').val('');
},
error: function(jqXHR, textStatus, errorThrown){
// log the error to the console
console.log(
"The following error occured: "+
textStatus, errorThrown
);
}
});
return false;
});
});
HTML
<form action="tweet.php" method="post" id="statusForm" name="statusForm" enctype="multipart/form-data">
<textarea id="txtArea" name="status" placeHolder="whatsup today" class="txtArea" onfocus="this.rows=7;"></textarea>
<input type="button" id="photo" value="+Image" class="buttons">
<input type="hidden" id="checkin">
<input type="submit" value="submit" class="Mbuttons" id="sub" name="submit">
</form>
I ll also appreciate any suggestion