How to make <input type=“file” /> editable?

2019-06-17 07:51发布

问题:

I have found some examples that explains how to make input type=file to be non editable. like <input type="file" onkeydown="blur()" />

But I made test application in Visual Studio and find out that <input type="file" /> in non editable by default.

How to make it editable?

thanks

回答1:

The behavior of <input type="file"> elements is very strictly controlled by browsers, and you cannot force them to do anything other than what they want to do. Generally, modern browsers will only allow a file picker to be used for selecting a file for upload. Your Javascript code can't set the value and can't see anything more than the tail file name (the name without prefixing directory names).



回答2:

The following jquery plugin can help in making a intput type="File" editable.

http://www.appelsiini.net/projects/filestyle



标签: html file input