[英]Sending files and data using jQuery Iframe transport plugin
I want to upload files and a few hidden fields to server using jQuery iframe-transport plugin. 我想使用jQuery iframe-transport插件将文件和一些隐藏字段上传到服务器。
http://cmlenz.github.com/jquery-iframe-transport/ http://cmlenz.github.com/jquery-iframe-transport/
I have form on the page, that contains inputs with type 'file' and 'hidden'. 我在页面上有表格,其中包含类型为“文件”和“隐藏”的输入。 I use code:
我使用代码:
$("#fileupload").submit(function() {
progress(1);
var data = $(":hidden", this).serializeArray();
console.log(data);
$.ajax(this.action, {
data: data,
processData: false,
files: $(":file", this),
iframe: true
}).complete(function(data) {
progress(0);
});
return false;
});
Variable 'data' contains: 变量“数据”包含:
[ { name: "description_0", value: "111"}, { name: "description_1", value: "222"}]
Files are sent to server, but data is not. 文件发送到服务器,但数据不发送。 I see information about files in Post tab in Firebug.
我在Firebug的“发布”标签中看到有关文件的信息。 There is no data info.
没有数据信息。
Can someone explain, why data info is not sent? 有人可以解释为什么不发送数据信息吗?
尝试使用序列化表单,并且输入的类型为“文件”的文件不会发送:“文件选择元素中的数据未序列化”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.