upload canvas data to s3

前端 未结 5 1553
刺人心
刺人心 2020-12-25 13:53

Now since the amazon has enabled CORS I was wondering if this is possible.

Can the html canvas data (on client browser) be converted to a <

5条回答
  •  清酒与你
    2020-12-25 14:33

    Using toBlob:

    canvas.toBlob((blob) => {
      if (blob === null) return;
      bucket.upload({
        Key: "where/the/file/goes.jpg"
        ContentType: "image/jpeg",
        Body: blob,
      }, (err, data) => {});
    }, "image/jpeg");
    

提交回复
热议问题