Welcome to the Alfresco Builder Network

Provides access to various APIs related to file upload features.

Class members

Methods

  • addToQueue(files: FileModel[]): FileModel[]
    Adds files to the uploading queue to be uploaded
    • files: FileModel[] - One or more separate parameters or an array of files to queue
    • Returns FileModel[] - Array of files that were not blocked from upload by the ignore list
  • cancelUpload(files: FileModel[])
    Cancels uploading of files.
    • files: FileModel[] - One or more separate parameters or an array of files specifying uploads to cancel
  • clearQueue()
    Clears the upload queue
  • getQueue(): FileModel[]
    Gets the file Queue
    • Returns FileModel[] - Array of files that form the queue
  • getUploadPromise(file: FileModel): any
    Gets an upload promise for a file.
    • file: FileModel - The target file
    • Returns any - Promise that is resolved if the upload is successful or error otherwise
  • isUploading(): boolean
    Checks whether the service is uploading a file.
    • Returns boolean - True if a file is uploading, false otherwise
  • uploadFilesInTheQueue(emitter?: EventEmitter<any>)
    Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
    • emitter: EventEmitter<any> - (Optional) Emitter to invoke on file status change

Events

NameTypeDescription
queueChangedFileModel[]Emitted when the file queue changes.
fileUploadFileUploadEventEmitted when a File model changes its state.
fileUploadStartingFileUploadEventEmitted when an upload starts.
fileUploadCancelledFileUploadEventEmitted when an upload gets cancelled by the user.
fileUploadProgressFileUploadEventEmitted during the file upload process and contains the current progress for a particular File model.
fileUploadAbortedFileUploadEventEmitted when a file upload gets aborted by the server.
fileUploadErrorFileUploadEventEmitted when an error occurs during a file upload.
fileUploadCompleteFileUploadCompleteEventEmitted when a file upload is complete.
fileUploadDeleteFileUploadDeleteEventEmitted when an uploaded file is removed from server.
fileDeletedstringThis can be invoked when a file is deleted from an external source to upload the file dialog status.

Details

Ignore list configuration

You can add an ignore list for files that you don't want to be uploaded on your CS. The configuration of this service is saved in the app.config.json file (see the App Config service for more information).

The example below shows how to filter out the : '.git', '.DS_Store' and 'desktop.ini' files. Each element of the ignore list is a glob pattern string, so you could exclude all the .txt files, for example, by adding a *.txt pattern to the list. You can also specify some more options about how to perform the check via the match-options parameter.

In the example below, we have added the nocase option (ie, ignore case when performing the glob match), so *.TXT will also match .txt, etc. For more information about the options available please check the documentation for the minimatch node module.

app.config.json

{
    "ecmHost": "http://localhost:3000/ecm",
    "bpmHost": "http://localhost:3000/bpm",
    "application": {
        "name": "Alfresco"
    },
    "files": {
          "excluded": [".DS_Store", "desktop.ini", ".git", "*.txt"],
          "match-options": {
            "nocase": true
          }
    }
}

Note that all standard glob patterns work and you can end patterns with a forward slash / character to specify a directory.

Interested in trying Alfresco?

Try Now