Link to home
Start Free TrialLog in
Avatar of dev09
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()+"&pic="+document.form1.pic.value,
  cache: false,
  dataType: "html",
  success: function(responseText){
    $("#displaydiv").html(responseText);
  }
});

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



ASKER CERTIFIED SOLUTION
Avatar of ncoo
ncoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ncoo
ncoo

If you're talking about actually uploading the file and not just getting the filename, take a look at: http://valums.com/ajax-upload/