How to set limit of input file field with jQuery

Hello everyone!

By default, in current implementation of HTML language in modern browsers input tag doesn’t support limit for uploading files.
And if you need to set limit of maximum uploading files in your field:

<input type="file" name="photos" multiple />

you can use a simple jQuery snippet:

	var limit_of_files = 5;

			alert('You exceeded limit for uploading files! Maximum of uploading files is 5!');
			return false;