adds error handling for uploads