123456789101112 |
- def upload_image(self, file_name):
- # Create blob with same name as local file name
- blob_client = self.blob_service_client.get_blob_client(container=MY_IMAGE_CONTAINER,
- blob=file_name)
- # Get full path to the file
- upload_file_path = os.path.join(LOCAL_IMAGE_PATH, file_name)
- # Create blob on storage
- # Overwrite if it already exists!
- image_content_setting = ContentSettings(content_type='image/jpeg')
- print(f"uploading file - {file_name}")
- with open(upload_file_path, "rb") as data:
- blob_client.upload_blob(data, overwrite=True, content_settings=image_content_setting)
|