谷歌云存储桶

问题描述 投票:0回答:1

我不知道在哪里可以找到或学习如何从我的下一个 js 应用程序上传图片到谷歌云存储。有什么想法我该怎么做吗?

  async function uploadImages(e) {
    if (productImages?.length > 0) {
      console.log('we got pictures to upload')
      const data = new FormData();
  
      productImages.forEach((element) => {
        console.log(element)
        data.append("file", element);
      });

      await fetch('/api/upload', {
        method: 'POST',
        body: data,
      }).then(ress=>ress.text()).then((s)=>console.log(x));
  
    }
  }

这是我的上传功能,我需要将图片上传到存储的 post api

next.js google-cloud-storage
1个回答
0
投票

Google Cloud 文档对此进行了介绍:

NodeJS SDK 上传文件

© www.soinside.com 2019 - 2024. All rights reserved.