我正在尝试使用新的File API对输入文件进行排序。它返回的列表似乎是不变的:

var x = "";
var files = e.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.

files.sort();

> Uncaught TypeError: Object #<FileList> has no method 'sort'

如果我想一次读取多个文件,但是我希望它们按顺序到达。 (A.csvB.csv等之前进行处理)。这是可以实现的吗?

最佳答案

[].slice.call(files)使其成为真实数组,然后可以在其上使用.sort

关于javascript - 排序FileList对象,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16020593/

10-12 12:40
查看更多