JavaScript: File uploader validator