how to filter the file type with the file upload control in asp.net & c#.net
for example on clicking the browse button of the file upload control ,it should open browse file dialog with only excel file types.
how is it possible
how to filter the file type with the file upload control in asp.net & c#.net
for example on clicking the browse button of the file upload control ,it should open browse file dialog with only excel file types.
how is it possible
I think it is not possible with
<input type="file"
control.I've heard about
SWFUploader
that allows to define extensions for files to upload, but this is a flash-based component.And even if you use
SWFUploader
, nothing will prevent you against typing*.*
, and selecting any file to upload.this is the answer from the other forum
I think it 's easy to realise it if you use C# (or VB,net) and .net fileupload control. you may define file types in arraylist "allowedExtensions".
when using Angular File Upload , this way you ca pass filters to uploder
.html file
.js file:
I refer to post # ASP.NET - Limit file upload available file types
Using RegularExpressionValidator can solve the problem easily. No serverside code is necessary for the checking of the extension anymore. Copy & Paste this code
It works perfectly!
You can use C1Upload from ComponentOne to do this. It has support for file type and size validation. Keep in mind, you will want to also validate on the server since file extensions can easily be changed to mismatch their actual type. This is a standard in any validation practice: validate in the UI layer then validate at the BL layer and preferably validate at the DL too. Here is a demo of the ASP.NET AJAX upload control with built-in validation.
Another cool thing about this control is that is supports multiple upload files and shows upload progress!