在Ionic 4中上传多张图片时出错

时间:2020-10-14 23:15:12

标签: ionic4

我使用了Ionic 4,当我上传多张图片时,它显示为空。

如果我将其转换为字符串

images : any[]

代码选择图像

this.imagePicker.getPictures({
    maximumImagesCount: 5,
    outputType: 1
}).then(selectedImg => {
    console.log(selectedImg);
    selectedImg.forEach(
        i => this.images.push("data:image/jpeg;base64," + i)        
    );
})

我的代码上传到服务器

const formDataa = new FormData();
formDataa.append("country", this.country);
formDataa.append("city", this.city);
formDataa.append("title", this.title);
formDataa.append("images", JSON.stringify(this.images));

现在图像显示为空,但显示console.log(this.images)中的数据 没有。

如果我从图像中删除[],则无法从图像库中选择图像。

0 个答案:

没有答案