0
votes

I am using Google App Engine PHP SDK.

Google cloud storage allows users to check a "publicly shared?" field in the storage manager that allows you to share a URL to the data directly.

I'm using google app engine and sending data to the storage, but I would like to have it publicly shared by default.

this is code which I am using to upload files

require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';
use google\appengine\api\cloud_storage\CloudStorageTools;

$options = [ 'gs_bucket_name' => 'my_bucket' ];
$upload_url = CloudStorageTools::createUploadUrl('/test.php', $options);

$gs_name = $_FILES['sample']['tmp_name'];
move_uploaded_file($gs_name, 'gs://test_sample/');

How can I do this? Their docs does not seem to mention anything about this, except manually doing it.

1

1 Answers

2
votes

You can define the permissions that your new uploaded files will have by default with the command:

gsutil defacl ch -u allUsers:R gs://<bucket>

And after you upload your files with your code they should be publicly shared.

Visit the following links for more information about the command:

Hope it helps.