check token before doing uploading