open a particular type of file using input of type="fil
open a particular type of file using input of type="file" in javascript
我试图使用<input type="file" ...>
打开文件并将其显示为文本。我希望弹出的对话框打开文件,以显示文件的特定扩展名,如"。txt"或"。jpg",而不是"所有文件"。我怎么能做到这一点单独使用javascript ?
您可以在输入中使用accept
属性:
<input type="file" accept=".txt,.jpg">
更多信息请参见MDN
相关文章:
- 如何将输入(type=text)从html表单传递到javascript函数
- 正在将base64 jpeg从input-type=file上传到服务器
- HighChart : Usage of setData
- 类型错误'未定义'不是对象(正在评估'navigator.connection.type'
- <输入id=“;“到期”;type=“;月份;min=“;2016-05”>如何填写“;min”;属性与当前
- angular type=[number]指令来阻止粘贴
- 节点,express应用程序返回text/javascript响应头(Content-Type),尽管设置了applic
- 未捕获错误:语法错误,无法识别的表达式:input[@type=submit]
- Difference between methods of defining JavaScript 'class
- 如何停止向上滚动<按钮dojoType=“;dijit.form.Button”;type=“;提交”/>在
- type=text/javascript和language=javascript之间的区别
- 为什么我在下面的..of循环中得到意外令牌
- Set the value of <input type="date"... in jquer
- “:last-of-type"或“.last()“;在使用JQuery时
- open a particular type of file using input of type="fil
- JavaScript issue with type attribute of <script> eleme
- CSS Behaviour for IE: first-of-type
- Set Value of input type in <td> through javascript
- POST the values of several html <input type='button
- jQuery nth-child nth-of-type Not Working