Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Promise.all(files.map(file =>
new AV.File(file.name, file).save().then(savedFile => $scope.send(new ImageMessage(savedFile)))
)).catch(console.error);
reader.onload = function () {
const file = new AV.File(AV.User.current().id, self._dataToBlob(this.result))
file.save().then(object => {
const data = self.state.data
self.setState({
data: data + `
![](` + object.attributes.url + `)`,
progressShow: false
})
}).catch(error => {
self.setState({ progressShow: false })
self._snackBarOpen('图片上传失败')
})
}
}
export function uploadPic(payload) {
const { image, name } = payload
const file = new AV.File(name, { blob: image })
return file.save().then(function(result) {
return result.toJSON()
})
}
export function uploadPic(payload) {
const { base64, name } = payload
const data = { base64: base64 }
const file = new AV.File(name, data)
return file.save().then(function(result) {
return result.toJSON()
})
}