dev09
asked on
jquery $.ajax processing the value in type="file"
Hi guys,
How do you add the value of what is sitting in a html form type of 'file' to be processed when in a jquery ajax function?
i.e. this is my script so far:
$.ajax({
type: "POST",
url: "resultspage.php",
data: $("#form").serialize()+"&p ic="+docum ent.form1. pic.value,
cache: false,
dataType: "html",
success: function(responseText){
$("#displaydiv").html(resp onseText);
}
});
When i run this, i get the value of: "C:\fakepath\filename.jpg" from the pic field.
And I can't find a way for serialize() to pass this value in either.
What is best used to capture this value so that it is just the file name?
Many Thanks
Paul
How do you add the value of what is sitting in a html form type of 'file' to be processed when in a jquery ajax function?
i.e. this is my script so far:
$.ajax({
type: "POST",
url: "resultspage.php",
data: $("#form").serialize()+"&p
cache: false,
dataType: "html",
success: function(responseText){
$("#displaydiv").html(resp
}
});
When i run this, i get the value of: "C:\fakepath\filename.jpg"
And I can't find a way for serialize() to pass this value in either.
What is best used to capture this value so that it is just the file name?
Many Thanks
Paul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're talking about actually uploading the file and not just getting the filename, take a look at: http://valums.com/ajax-upload/