• File upload with specific file type in C#

    by  • June 3, 2013 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    Checking specific file types by using FileUpload control in C# is very easy. Well you just need to check extension of the file and match this extension with allowed extensions before uploading it in your desired location. Following code snippet will show you how you easily you can do it. This code snippet is also available to download at the bottom of the article. Keep visiting GetCodeSnippet.com for more code snippets.


    First of all, see the controls I have used to describe this matter.


    Now see the code

    I have simply got the name and extension of the file and used a simple function to check the file extension is matching with one of file extensions which I have allowed to upload.

    Best WordPress Themes and Plugins with Great Team and Support!

    Avatar of GetCodeSnippet.com


    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply