【发布时间】:2018-08-25 15:43:04
【问题描述】:
我的案子需要帮助。 我正在使用 react-native-image-picker 来挑选图片,目前的问题是何时需要上传图片。
我准备了presignedurl
//here I get the presigned url
const uploadConfig = await profileApi.getUpdateUrl(id);
//I prepare file from response of imagepicker : uri , filename , file type, data(base64 file)
const file = {
uri: values.Avatar.uri,
name: values.Avatar.fileName,
type: values.Avatar.type,
data: value.Avatar.data,
};
//upload to presignedurl of S3 , already tried file.data , file.uri respectively but it resulted same
const resultUpload = await axios.put(uploadConfig.data.url, file, {
headers: {
'Content-Type': file.type,
},
});
结果被接受,没有错误,但结果是空白图像,当我下载时不是图像。
【问题讨论】:
标签: reactjs react-native amazon-s3 image-upload