File Entry - Preventing specific file types and sizes from being selected

Is there a way to prevent the user from selecting a file that is not the specified file type when they have a browser for the file on their computer? For example, when a user views the download of an image file, I would like them to see only images (jpg, png, ect.) That are less than 20 MB. Is this something that can be done using asp.net mvc and jquery or do I need to use flash or a java applet?

+3
source share
4 answers

Try plupload: http://plupload.com/

Flash, Silverlight, HTML5, Gears .. . HTML5- , , .

+2

- -. , .

SWFUpload. , , Uploadify, .

.

+1

http://www.cs.tut.fi/~jkorpela/forms/file.html#filter, , , accept , - . , .

I agree with Sky Sanders on this. Use the flash loader if you want to provide a file filter.

0
source

You can apply to the solution after selection.

var myFiles = document.getElementById('myFileInput');
for(xi=0;xi<myFiles.files.length;xi++)
{
controlThat(myFiles.files[xi].fileName,myFiles.files[xi].mediaType);
}

In the controlThat function, you can check and select which type of file you want to continue, or warn your notifications.

0
source

Source: https://habr.com/ru/post/1743462/


All Articles