CabloyJS has a built-in file upload module a-file, which has the following features:

  • Out of the box, easy to use
  • Support for image crop
  • Support image, audio and common file upload
  • Can associate files with atom and inherit the access rights of atom
  • Support the x-accel-redirect parameter of nginx to improve the file download performance

How to Use

Refer to the mechanism of Page Open & Return Value, directly open the file upload page, pass in the parameters, and then obtain the file download information returned by the backend


onPerformImage() {
  return new Promise((resolve, reject) => {
    this.$view.navigate('/a/file/file/upload', {
      context: {
        params: {
          mode: 1,
          // atomId: 0,
        callback: (code, data) => {
          if (code === 200) {
            this.imageUrl = data.downloadUrl;
          if (code === false) {

Path of Upload Page

The absolute path: /a/file/file/upload


Name Description
mode 1: image, 2: normal files, 3: audio
atomId the atomId associated with the file, when mode = 2, inherits the access rights of the atom
flag file’s flag, which can be customized according to the application scenario

Return Value

Name Description
fileId file Id
realName file Name
downloadId file download Id
downloadUrl file download URL