1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【JavaScript】DataTransfer.files (FileList) の順番はドラッグしたときに掴んだファイルによって変わる

Last updated at Posted at 2022-02-25

結論

文章だと説明しにくいので例をあげます。

以下のファイルを選択したとします。
1.txt
2.txt
3.txt
4.txt

上記の状態から「どのファイルを掴んでドラッグを始めたか」によって FileList の順番が変わります。
1.txt を掴んでドラッグを始めた場合 1, 2, 3, 4
2.txt を掴んでドラッグを始めた場合 2, 3, 4, 1
3.txt を掴んでドラッグを始めた場合 3, 4, 1, 2
4.txt を掴んでドラッグを始めた場合 4, 1, 2, 3

てっきりファイル名昇順だと思い込んでいたのでハマりました😅

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?