I have a code that works well with S3, but after switching to Spaces it doesn’t check the MD5 hash. So even if I change the $md5
variable, the upload finishes successfully.
The fun fact is that this is only a problem with content-md5
. The content-type
check works fine.
Is there a way to check the file integrity after uploading in Spaces?
I have no idea how to fix it.
$formInputs = [
'acl' => 'private',
'key' => $name,
'success_action_status' => '201',
'content-md5' => $md5,
'content-type' => $contentType,
];
$options = [
['acl' => 'private'],
['bucket' => $bucket],
['success_action_status' => '201'],
['content-md5' => $md5],
['content-type' => $contentType],
['content-length-range', 0, 1024 * 1024 * 100],
['starts-with', '$key', $userId . '/'],
];
$postObject = new PostObjectV4($client, $bucket, $formInputs, $options, '+15 minutes');
$formAttributes = $postObject->getFormAttributes();
$formInputs = $postObject->getFormInputs();
return [$formAttributes, $formInputs];
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.