-1

我在Retool上使用JSON Schema Form将图像上传到云存储

在此处输入图像描述

这是 JSON 模式:

{
  "type": "object",
  "properties": {
    "image": {
      "type": "string",
      "format": "data-url",
    }
  }
}

这是我上传的图片:

在此处输入图像描述

然后,我可以使用查询设置成功上传图像:

在此处输入图像描述

这是上传到云存储上的图片:

在此处输入图像描述

但是,在云存储上,打开图片的“对象详情”时,并没有显示图片:

在此处输入图像描述

此外,当打开图片的Authenticated URL时,图片也没有显示:

在此处输入图像描述

我所做的有什么遗漏吗?

4

1 回答 1

1

This code for "Upload data" contains not just the "Image Data" but also other data like the "Content-Type", the "File Name" and the "Encoding Schemes":

enter image description here

{{ form.data.image }}

So you need to extract only the "Image Data" with this code:

{{ form.data.image.split(',')[1] }}

In addition, for "Upload file name",

enter image description here

You can extract the "File Name" "orangeHoney.jpg" as well with this code:

enter image description here

{{ form.data.image.split("name=")[1].split(";")[0] }}

This is the uploaded image on cloud storage uploaded with the 2 sets of code above:

enter image description here

Then, on cloud storage, when opening the "Object details" of the image, the image was displayed:

enter image description here

Moreover, when opening the Authenticated URL of the image, the image also was displayed:

enter image description here

于 2021-10-23T18:02:50.453 回答