Jasny Bootstrap: 我可以指定文件输入只接受图像吗?
Jasny Bootstrap: can I specify File Input to accept only images?
我使用 Jasny Bootstrap 进行文件输入:
http://www.jasny.net/bootstrap/javascript/#fileinput
是否可以将输入文件类型指定为仅接受图像?像这样:
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
是的,这是可能的,因为它是 input 标签的标准属性值。 Jasny 对此没有任何改变。
但是,您应该知道 accept tag does not work in all browsers: http://caniuse.com/#feat=input-file-accept
我使用 Jasny Bootstrap 进行文件输入: http://www.jasny.net/bootstrap/javascript/#fileinput
是否可以将输入文件类型指定为仅接受图像?像这样:
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
是的,这是可能的,因为它是 input 标签的标准属性值。 Jasny 对此没有任何改变。
但是,您应该知道 accept tag does not work in all browsers: http://caniuse.com/#feat=input-file-accept