ASP.NET - Limit file upload available file types

后端 未结 10 1217
忘了有多久
忘了有多久 2020-12-13 14:28

I have added a file upload to my asp.net website. However, I want to limit the file types that user can select. For example, I only the user to select mp3 files. How can I a

10条回答
  •  天涯浪人
    2020-12-13 14:35

    Using RegularExpressionValidator may help you. No serverside code is necessary for the checking of the file extension. Check out this code

    
    

    Remember all you have to do is now add a fileupload control with the id FileUpload1. Done. You can press F5 and see the effect

提交回复
热议问题