Adding error checking to UploadHandler.