Skip to content Skip to sidebar Skip to footer

Pageblob Upload As Multiple Chunks: X-ms-range Invalid

This is a follow-up question to my previous question. What I realized is I can only upload 4 mega bytes max to Azure. So I was trying to modify the code to chunk upload to pageblob

Solution 1:

The problem is with the following line of code:

CHUNK_MAX_SIZE = int(4e+6) # 4 mega bytes

It gives you 4000000 which is not 4MB. 4MB is 4194304 bytes.

Please try by changing your code to:

CHUNK_MAX_SIZE = 4 * 1024 * 1024# or 4194304

and your code should work fine.

UPDATE

Please change the following line of code:

conn.request('PUT', sas_uri + '&comp=page', file, headers)

to

conn.request('PUT', sas_uri + '&comp=page', chunk, headers)

and you should be able to upload the file. Essentially I changed file to chunk in your code as you would want to just upload the chunk and not the entire file.

Post a Comment for "Pageblob Upload As Multiple Chunks: X-ms-range Invalid"