I’m trying to serialize my form data including file image field using jquery.form.js jQuery API.
The API is helping me to serailze data fields including image and return image object as [object file]
Here is my code for serialization
var data = $js("form[name=ajx_imgupload]").formSerialize();
var img = $js("#upload_image").fieldSerialize();
$js.ajax({
url: "index.php?option=com_obituary&task=upload",
type: "POST",
dataType:"json",
data: data,
beforeSend: function(){
$js(".loadingblock").show();
},
complete: function(){
$js(".loadingblock").hide();
},
success: function(res){
alert();
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus);
}
});
Stuck with issue… Help will be much appreciated.
Thanks
let me help you. I made this just 1 day ago. I have form including image field. when you submit it its uploading image via
jquery.form.jsNote: I am uploading file with jqueryimageupload.php, if you want I can paste it. It is a simple php file upload. http://www.w3schools.com/php/php_file_upload.asp
html part:
jquery:
at last form submit: