mikebz
mikebz

Reputation: 3335

Azure PUT BlockList returns 400 (Block ID is invalid. Block ID must be base64 encoded.)

I have what seems to be a pretty simple test of uploading a large file to Azure Blob storage.

The response I get is 400: 400 (Block ID is invalid. Block ID must be base64 encoded.)

The URL I am uploading to is: https://xxxx.blob.core.windows.net/tmp/af620cd8-.....&comp=blocklist

with the body:

<?xml version="1.0" encoding="utf-8"?>
<BlockList>
<Latest>BLOCK0</Latest>
<Latest>BLOCK1</Latest>
</BlockList>

This comes after a couple of successful block uploads: https://xxxx.blob.core.windows.net/tmp/af620cd8-02e0-fee2....&blockid=BLOCK0 etc.

It doesn't seem like anything here requires Base64 encoding and the block IDs are of the same exact size (something mentioned in another post). Is there anything else I could try here?

The complete code is here: https://github.com/mikebz/azureupload and the specific front end file is here: https://github.com/mikebz/azureupload/blob/master/formfileupload/templates/chunked.html

Upvotes: 1

Views: 886

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136356

The block ids must be base64 encoded and because you're not doing so, you're getting this error.

From Put Block REST API documentaion:

blockid: Required. A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Note that the Base64 string must be URL-encoded.

Upvotes: 3

Related Questions