Added error handler for file upload