I'm using the Azure SDK to perform basic operations on an Azure files storage. In order to support larger file uploads I support chunked uploads, so I'm calling:
$storage->createFileFromContent(...)
on the first chunk and
$storage->putFileRange(...)
on all the following.
The first request works fine and the file is filled with inside the first range specified. The second and following requests however fail with the error:
Code: 416
Value: The range specified is invalid for the current size of the resource.
Here are my specified headers for the first request:
{
["x-ms-range"]=>"bytes=0-2999999"
["content-length"]=>3000000
["x-ms-write"]=>"Update"
}
Actual size of the stream: 3000000
And for the second request:
{
["x-ms-range"]=>"bytes=3000000-5999999"
["content-length"]=>3000000
["x-ms-write"]=>"Update"
}
Actual size of the stream: 3000000
Can someone please tell me what is wrong?? I also tried to adjust the Range to something like 300000-6000000, but then I get this error:
"Code: 400 Value: The value for one of the HTTP headers is not in the correct format. >> Content-Length"
Could this be caused by a wrong configuration of the storage in Azure?