更改文件时更新输入[type = file]的状态 [英] Update the status of a input[type=file] when change files

查看:116
本文介绍了更改文件时更新输入[type = file]的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input type =fileid =fileSelectormultiple =真> 

如果我在此输入内添加或删除文件,它不更新其文本。

  fileSelector.files = []; 

例如,如果它的文本是2个文件选择并且我改变了文件数组,它不会更新这个文本。



如何更新这个文本?

解决方案

这是不可能的设置< input type =file> 元素的 FileList code> .files 以编程方式; FileList 是只读的


I've this file input:

<input type="file" id="fileSelector" multiple="true">

If I add or remove files inside this input, it doesn't update its text.

fileSelector.files = [];

E.g, if its text is "2 files selected" and I change the files array, it doesn't update this text.

How to update this text?

解决方案

It is not possible to set the value of FileList of <input type="file"> element .files programmatically; FileList is read-only

这篇关于更改文件时更新输入[type = file]的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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