How do I restrict file types with the HTML input file type?
I have this
<input type="file" id="fileUpload" name="fileUpload" size="23" accept="Calendar/ics"/>
I am trying to restrict the type to only the iCalendar format type.
I also want to check it on the server side. How do I do this in ASP.NET MVC?
Unfortunately, you can’t restrict the file extension like you can in a standard file browser dialog. You can, however, check the extension once the user selects a file.
You can add this event handler.
and this JavaScript function
You should also check it on the server, using:
and: