I'm trying to upload a base64 image to Azure Storage File Share, but an error happens.
how can I solve?
ShareFileClient dirClient = new ShareFileClientBuilder()
.endpoint("https://xxx.file.core.windows.net")
.shareName("xxx")
.resourcePath("photos")
.credential(new StorageSharedKeyCredential("xxx", "xxx"))
.buildFileClient();
byte[] bytes = Base64.decodeBase64("iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==");
try (ByteArrayInputStream dataStream = new ByteArrayInputStream(bytes)) {
dirClient.upload(dataStream, bytes.length);
} catch (IOException e) {
e.printStackTrace();
}
pom.xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-file-share</artifactId>
<version>12.2.0</version>
</dependency>
error
Status code 416, "<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidRange</Code>
<Message>The range specified is invalid for the current size of the resource.
RequestId:e9efce20-501a-006d-31a5-f67649000000 Time:2021-01-30T01:14:24.3586552Z
</Message>
</Error>
Solution