def upload(self, local_path):
        new_hash = self.generate_content_hash(local_path)
        if new_hash != self.content_hash:
            self.unlink()
            self.content_hash = new_hash

        if not self.exists():
            try:
                logger.info("Uploading %s to %s" % (local_path, self.remote_path))
                self.get_storage().save(self.remote_path, open(local_path))
            except Exception as e:
                logger.error("Error saving '%s' to remote storage: %s" % (local_path, e))
                raise
        try:
            os.unlink(local_path)
        except OSError as e:
            logger.error("Error removing file '%s': %s" % (local_path, e))
Upload an encoded file to remote storage and remove the
dataset/ETHPy150Open jbittel/django-multimedia/multimedia/models.py/RemoteStorage.upload