C:\fakepath\*.* in Ajax and jQuery

This question already has an answer here:

  • How can I upload files asynchronously? 27 answers
  • How do I send a cross-domain POST request via JavaScript? 17 answers

  • You are sending by ajax filename, not it content:

    fbndoc: $('#fbndoc').val()
    

    If you want to upload file with it content by ajax better use FormData , for example with jQuery:

    var fd = new FormData($('#fbndoc').get(0));
    fd.append("CustomField", "This is some extra data");//add all you data here like this
    $.ajax({
      url: "stash.php",
      type: "POST",
      data: fd,
      processData: false,  // tell jQuery not to process the data
      contentType: false   // tell jQuery not to set contentType
    });
    
    链接地址: http://www.djcxy.com/p/19622.html

    上一篇: 使用ajax将.js文件的blob发送到php

    下一篇: C:\ fakepath \ *。*在Ajax和jQuery中