add error handling for file upload