Google App Engine PHP SDK - Google云端存储 - 访问上传文件的内容

时间:2022-08-22 11:20:20

i have a form on a page using CloudStorageTools::createUploadUrl for the action...

我在页面上有一个表单,使用CloudStorageTools :: createUploadUrl进行操作...

i set up my bucket to receive the file, and that works fine... i see the $_FILE populated, and the [tmp_name] is set to a "gs://bucket/key" URL... i can use move_uploaded_file to copy the file with a different name, so my app definitely has access to the bucket and can make changes...

我设置我的桶来接收文件,并且工作正常...我看到填充$ _FILE,并且[tmp_name]设置为“gs:// bucket / key”URL ...我可以使用move_uploaded_file复制具有不同名称的文件,因此我的应用程序肯定可以访问存储桶并可以进行更改...

when i use file_get_contents on the same filepath, i get nothing... fopen returns false.

当我在同一个文件路径上使用file_get_contents时,我什么都没得到... fopen返回false。

i tried to get the public URL to the file and then requesting it with an HTTPS stream, but that returned

我试图获取该文件的公共URL,然后使用HTTPS流请求它,但返回

<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message></Error>

i tried adding all the google api OAuth tokens and API version, but it still returned AccessDenied.

我尝试添加所有谷歌api OAuth令牌和API版本,但它仍然返回AccessDenied。

is something wrong on GAE? how can i retrieve an uploaded file's contents?

GAE出了什么问题?如何检索上传文件的内容?

1 个解决方案

#1


0  

Is the acl of the file set to 'public-read'? https://developers.google.com/appengine/docs/php/googlestorage/#writing_to_google_cloud_storage

文件的acl是否设置为'public-read'? https://developers.google.com/appengine/docs/php/googlestorage/#writing_to_google_cloud_storage

#1


0  

Is the acl of the file set to 'public-read'? https://developers.google.com/appengine/docs/php/googlestorage/#writing_to_google_cloud_storage

文件的acl是否设置为'public-read'? https://developers.google.com/appengine/docs/php/googlestorage/#writing_to_google_cloud_storage