首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >上载流文件内容时Azure Storage PHP客户端无法进行身份验证

上载流文件内容时Azure Storage PHP客户端无法进行身份验证
EN

Stack Overflow用户
提问于 2019-10-10 20:45:38
回答 1查看 69关注 0票数 0

我正在使用azure-storage-php库将文件复制到Azure存储文件共享。

一般情况下,将文件移动到文件共享是可行的,但在使用流式文件内容时,我会收到一个身份验证错误:

代码语言:javascript
复制
Fail:
Code: 403
Value: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
details (if any): <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:070c24e7-ABCD-EFGH-7f8e6d000000
Time:2019-10-10T11:45:35.8832342Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'X+WJOUaKHhOABCDEFGHIJKLMNOPQRSTUVWXYZe5Iu2k=' is not the same as any computed signature. Server used following string to sign: 'PUT


568340

text/csv
Thu, 10 Oct 2019 11:45:35 GMT





x-ms-range:bytes=0-568339
x-ms-request-id:5d9f19dfd2dae
x-ms-version:2016-05-31
x-ms-write:Update
/username/file-share-name/myFile.csv
comp:range'.</AuthenticationErrorDetail></Error>

我已经确保了系统时间是同步的,因为有些人对此有问题。

该文件甚至是在存储上创建的,并填充了许多行

代码语言:javascript
复制
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

我使用https://github.com/thephpleague/flysystem作为抽象层。为了打开流,我尝试使用$stream = fopen('filePath.csv', 'rb')$flysystem->readStream('localFilesystem', 'filePath.csv');

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-14 14:56:56

根据Gaurav Mantri的提示,我认为只有当流式文件的大小低于某个阈值时,才会出现错误。在我的例子中,这大约是4MB。

上传小于4MB的流文件导致上述错误。

上传流文件> 4MB的效果很好。

不幸的是,我无法解释为什么会发生这种情况。现在,我使用一种变通方法在上传文件之前检查文件大小,然后使用直接上传或对较大的文件使用流。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58323221

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档