我正在尝试将 base64 图像上传到 Azure 存储文件共享,但发生错误。
我该如何解决?
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>
错误
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>