【问题标题】:uploading image to google cloud storage from app (IOS or android)从应用程序(IOS 或 android)将图像上传到谷歌云存储
【发布时间】:2018-12-22 13:43:24
【问题描述】:

我正在使用本机反应,并希望将图像上传到 gcp 存储 我没有使用任何应用程序引擎。 根据节点的 gcp 文档

const Storage = require('@google-cloud/storage');
const storage = Storage({
  projectId: 'id',
  keyFilename: 'private-key'
});

const bucketName = 'buckt';

// Uploads a local file to the bucket
storage
  .bucket(bucketName)
  .upload('filename')
  .then(() => {
    console.log(`${filename} uploaded to ${bucketName}.`);
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

要在客户端使用此代码,我需要传递我不想做的私钥

根据这篇博文https://medium.com/google-cloud/uploading-resizing-and-serving-images-with-google-cloud-platform-ca9631a2c556 ,谷歌应用引擎中有一个get_serving_url()函数。

我认为对于谷歌推送通知,谷歌提供每个客户端令牌,以便客​​户端直接与服务器通信

有什么方法可以直接从客户端上传图片?

【问题讨论】:

    标签: node.js google-cloud-platform google-cloud-storage


    【解决方案1】:

    您可以使用 Firabase 云存储服务。此服务基于 Firebase 身份验证凭据从客户端安全地上传到 GCP 存储。见:https://firebase.google.com/docs/storage/

    【讨论】:

      猜你喜欢
      • 2015-06-13
      • 2015-02-28
      • 1970-01-01
      • 2018-07-11
      • 2017-05-03
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 1970-01-01
      相关资源
      最近更新 更多