Refactor file validation.
Refactor file validation.

Resolves #3547.

blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload