How to use the leancloud-storage.File function in leancloud-storage

To help you get started, we’ve selected a few leancloud-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leancloud / leanmessage-demo / src / app / conversation / conversationMessage / conversation.message.controller.js View on Github external
return Promise.all(files.map(file =>
      new AV.File(file.name, file).save().then(savedFile => $scope.send(new ImageMessage(savedFile)))
    )).catch(console.error);
github liangtongzhuo / vscodechina / src / js / write / index.js View on Github external
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('图片上传失败')
      })
    }
  }
github zxj963577494 / OverWatchTeams-React-Native-Expo / src / services / leanclound / common.js View on Github external
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()
  })
}
github zxj963577494 / OverWatchTeams / src / services / leanclound / common.js View on Github external
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()
  })
}