![](/img/trans.png)
[英]Blazor Server App, How can I bind my local file to the InputFile Component without browse
[英]Using the Blazor InputFile tag- how can I control the file type shown when I browse
我可以控制单击按钮浏览目录和 select 文件时显示的文件类型过滤器吗?
例如,我只想 select *.xml 文件。
您可以通过添加接受属性来限制文件类型
<InputFile OnChange="OnFileChange" accept=".xml" />
更多信息在这里https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
您可以使用接受属性:
<InputFile OnChange="@OnInputFileChange" multiple accept=".xml,.xsdl"/>
我为需要一种以上文件类型的人编写了两个扩展名( .xml,.xsdl
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.