How to change order of files in multiple file input?

后端 未结 1 389
北海茫月
北海茫月 2020-12-17 04:41

The files are ordered alphabetically by default; is there any way to upload them in the order they were chosen in the file picker instead?

I want to be able to sele

相关标签:
1条回答
  • 2020-12-17 05:40

    The files are actually not ordered alphabetically. They are lined in the order of appearance in the file picker (at least that is how current Chrome and Firefox work on Windows 7). You simply had them sorted by name in the picker.

    I don't think what you're asking is possible. You could either:

    • instruct the user to make sure the primary file is always first in the list (however, I believe there is no guarantee of the order by browsers).
    • create a separate input element for the primary file.
    • (recommended) display the file names (and/or content) and allow the user to select the file he wishes to be primary. Store that information in some hidden field with JavaScript.
    0 讨论(0)
提交回复
热议问题