我正在使用azure-storage-php库将文件复制到Azure存储文件共享。
一般情况下,将文件移动到文件共享是可行的,但在使用流式文件内容时,我会收到一个身份验证错误:
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>我已经确保了系统时间是同步的,因为有些人对此有问题。
该文件甚至是在存储上创建的,并填充了许多行
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');
发布于 2019-10-14 14:56:56
根据Gaurav Mantri的提示,我认为只有当流式文件的大小低于某个阈值时,才会出现错误。在我的例子中,这大约是4MB。
上传小于4MB的流文件导致上述错误。
上传流文件> 4MB的效果很好。
不幸的是,我无法解释为什么会发生这种情况。现在,我使用一种变通方法在上传文件之前检查文件大小,然后使用直接上传或对较大的文件使用流。
https://stackoverflow.com/questions/58323221
复制相似问题