如何更改多个文件输入中的文件顺序? [英] How to change order of files in multiple file input?

查看:774
本文介绍了如何更改多个文件输入中的文件顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,这些文件按字母顺序排列;有什么办法来上传他们在文件选择器中选择他们的顺序吗?



我希望能够在同一个输入中选择主文件和其他额外文件,而不必提交多个输入/时间。 b $ b

解决方案

文件实际上并不按字母顺序排列。他们排队在文件选择器的外观顺序(至少这是当前的Chrome和Firefox在Windows 7上工作)。您只需在选择器中按名称进行排序。



我不认为您所要求的是可能的。你可以:


  • 指示用户确保主文件始终位于
    列表中(但是,我相信
    浏览器无法保证订单)。
  • 为主文件创建一个单独的输入元素。

  • (推荐)显示文件名(和/或内容),并允许用户选择他希望成为主要文件的文件。使用JavaScript将这些信息存储在隐藏字段中。


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 select a primary file and then other extra files in the same input without having to submit more than one input/time.

解决方案

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.

这篇关于如何更改多个文件输入中的文件顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆