add error handling to uploaded files