0

I have tried adding it in my code but it does not seem to work. All my form values are serialized and posted through ajax submit, but I am unable to post my file name as it requires enclosure type to be added.

submitHandler: function() {
 $.post('abc.php', 'enctype:multipart/form-data',
 $('form#jobseeker_form').serialize() , 
  function(data){
   alert(data.msg);
  },"json");
}
Louis van Tonder
  • 3,664
  • 3
  • 31
  • 62
  • possible duplicate of [Jquery/Ajax Form Submission (enctype="multipart/form-data" ). Why does 'contentType:False' cause undefined index in PHP?](http://stackoverflow.com/questions/20795449/jquery-ajax-form-submission-enctype-multipart-form-data-why-does-contentt) – Aditya Singh Aug 01 '14 at 04:57

1 Answers1

0

You cannot upload file using ajax. You need to use a plugin which upload file's for you without refereshing the page and return you the file name. Then you can store the return file name into a hidden field in your form and submit data using serialize method.

check this link for file upload plugin using ajax.
http://malsup.com/jquery/form/#file-upload

t.niese
  • 39,256
  • 9
  • 74
  • 101
Sandeep Pal
  • 2,067
  • 1
  • 16
  • 14