我想用 HTML5 表单数据对象在数组中获取多个文件,
// HTML5 form data object.
var fd = new FormData();
jQuery.each(fileList, function (i, file) {
fd.append('file[' + i + ']', file);
});
结果,
Array
(
[file] => Array
(
[name] => Array
(
[0] => 1402236_566802636708984_1354256864_o.jpg
[1] => 287481_456592524374335_1348353782_o.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
)
[tmp_name] => Array
(
[0] => C:\wamp\tmp\php5A1E.tmp
[1] => C:\wamp\tmp\php5A21.tmp
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 217360
[1] => 144071
)
)
)
但我追求这个结果,
Array
(
[file] => Array
(
[0] => Array
(
[name] => 1402236_566802636708984_1354256864_o.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php35C1.tmp
[error] => 0
[size] => 217360
)
[1] => Array
(
[name] => 964570_566803006708947_840223346_o.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php35C4.tmp
[error] => 0
[size] => 518594
)
)
)
可能吗?