Improve upload file error processing