Validate the file before uploading