Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the Blazor InputFile tag- how can I control the file type shown when I browse

Tags:

.net

blazor

Can I control the file type filter shown when I click the button to browse a directory and select file(s)?

I want to select only *.xml files for example.

like image 703
GilShalit Avatar asked Sep 06 '25 03:09

GilShalit


1 Answers

you can limit the file type by adding the accept attribute

<InputFile OnChange="OnFileChange" accept=".xml" />

more information here https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept

like image 75
David Masterson Avatar answered Sep 13 '25 17:09

David Masterson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!