I'm trying to update a project to using resumable uploads and have managed to upload to my bucket using client-side to handle all PUT requests.
One issue I have though is setting the ACL on the object itself.
Client Side.
I have tried setting the header on the PUTs with both,
'x-goog-acl':'public-read' and 'acl':'public-read'
The latter works fine on my non-resumable uploading, but I'm not 100% on which I'm expected to use with resumable or if it even matters.
Server Side
I'm using the 'beginSignedUploadSession' method with the Google Cloud Storage for PHP Library
I've seen examples like.
$bucket->upload(
fopen('/data/file.txt', 'r'),
[
'predefinedAcl' => 'publicRead'
]
);
So I've tried...
$url = $object->beginSignedUploadSession([
'predefinedAcl' => 'publicRead'
]);
However looking at the docs, the predefinedAcl parameter does not seem to be supported for this method.
beginSignedUploadSession Parameters
The only thing I can think to try is using the headers directly, like..
$url = $object->beginSignedUploadSession([
'headers' => array('x-goog-acl' => 'public-read'),
'contentType' => $filetype
]);
Although this seems to also fail with both 'x-goog-acl' and 'acl' headers.
So, my question is, does anyone know of the correct way to set the ACL on an object using the beginSignedUploadSession method or whether there is a workaround if it is not possible directly ?
Thanks.
Update
So far the only way I've been able to do this is to edit the source of the library.
I've hard coded the header in google-cloud-php/Core/src/Upload/SignedUrlUploader.php with..
'x-goog-acl' => 'public-read'
This is obviously horrible, but it works for me for now.
I'm still very much interested in the correct way, or as to why the header isn't getting passed through. If I find out at a later date, then I'll update this post.
Thanks again.