In a Django project, I'm uploading video files to an Azure storage via the following snippet:
content_str = content.read()
blob_service.put_blob(
'videos',
name,
content_str,
x_ms_blob_type='BlockBlob',
x_ms_blob_content_type=content_type,
x_ms_blob_cache_control ='public, max-age=3600, s-maxage=86400'
)
where name
is a random uuid
string and videos
is the name of the container. How do I upload the video files without specifying a container, i.e. de facto creating a unique container for every file I upload?
How do I upload the video files without specifying a container, i.e. de facto creating a unique container for every file I upload?
Each blob (a video file in your case) must belong to a container. So what you could do is create a container using blob_service.create_container
before you call blob_service.put_blob
. You can name the container as uuid
.