我开始使用优秀的 http://blueimp.github.io/jQuery-File-Upload/文件上传项目.
从文档的文件处理选项部分看来,jquery.fileupload-process.js似乎可以解析甚至修改文件的二进制数据(文件数组 - 应用了进程的结果,原始文件包含原始上传的文件)
(解析,附加或加密或对其做某事)
但对于我的生活,我似乎无法弄清楚数组中的实际文件数据在哪里,以便我可以在上传之前对其进行预处理.
数据数组的哪一部分有"something.pdf"二进制文件?这样我才能在上传之前解析并转换它?
//FROM: jquery.fileupload-process.js
//The list of processing actions:
processQueue: [
{
action: 'log'
}
],
add: function (e, data) {
var $this = $(this);
data.process(function () {
return $this.fileupload('process', data);
});
originalAdd.call(this, e, data);
}
},
processActions: {
log: function (data, options) {
console.log(data.files[0]); //Is it here?
console.log(data); //Is it here?
console.log(data.files[data.index]); //Is it here?
console.log(data.files[data.index].name); //Is it here?
//where?
Run Code Online (Sandbox Code Playgroud)
谢谢.