简体   繁体   中英

How can I filter a FileDialog depending on a dropdown selection?

I think this is a two-in-one question.. one, is: How do you filter valid file types in a FileDialog for a Html page?

Im using ASP.NET MVC and currently showing the textbux/browse button this way:

<%= Html.TextBox("Order.LoanInfo.FilePath", null, new { style = "width: 800px;", type = "file" })%>

and the second is : How could you do to filter the file dialog depending on the selection of a dropdownlist ? I assume it would involve some jQuery and changing the attributes of the input in the DOM, but I dont really know what would need to be done.

Thanks!

There was a question like this earlier today.

There is not a consistent way to accomplish this the way you are wanting to without adding dependencies.

You may be able to make use of the accept attribute of the input tag , but browser support for this is lacking. See this question for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM