如何使用jQuery结合HTML5 FormData上传文件?
- 内容介绍
- 文章标签
- 相关推荐
本文共计83个文字,预计阅读时间需要1分钟。
在整合jQuery时,请注意以下代码片段:
javascriptvar fd=new FormData(document.getElementById('fileinfo'));fd.append('CustomField', 'This is some extra data');$.ajax({ url: st});
集成jQuery要注意的varfdnewFormData(document.getElementById(fileinfo));fd.append(Cust 集成jQuery要注意的var fd new FormData(document.getElementById("fileinfo"));fd.append("CustomField", "This is some extra data");$.ajax({url: "stash.php",type: "POST",data: fd,processData: false, // 告诉jQuery不要去处理发送的数据contentType: false // 告诉jQuery不要去设置Content-Type请求头});
本文共计83个文字,预计阅读时间需要1分钟。
在整合jQuery时,请注意以下代码片段:
javascriptvar fd=new FormData(document.getElementById('fileinfo'));fd.append('CustomField', 'This is some extra data');$.ajax({ url: st});
集成jQuery要注意的varfdnewFormData(document.getElementById(fileinfo));fd.append(Cust 集成jQuery要注意的var fd new FormData(document.getElementById("fileinfo"));fd.append("CustomField", "This is some extra data");$.ajax({url: "stash.php",type: "POST",data: fd,processData: false, // 告诉jQuery不要去处理发送的数据contentType: false // 告诉jQuery不要去设置Content-Type请求头});

