Possible Duplicate:
Javascript file uploads
I am using jQuery post to Post data to a PHP file. It's working fine for the input text,textarea
. But I want it to work with input type file
as well. Here's my code, how can I adapt it?
<input type="file" name="image">
$.ajax({
type : "post" ,
url : LIB_PATH + "sharefund/sharefund.php" ,
data : $("form[name=sharefunds]").serialize() ,
dataType : "json",
success : function(retData){
alert(retData);
if(retData != null && retData.hasOwnProperty("response"))
{
if(retData.response.code == '400')
{
$("span.error").html("Unable to update address, please try again later .").show();
}
if(retData.response.code == '200')
{
$("span.error").html("Your address has been updated successfully.").css('color' , 'green').show();
}
}
__removeOverlay();
setTimeout(function(){
$("span.error").slideUp();
}, 5000);
}
});