Welcome to the Alfresco Builder Network

Our technical resource site is still being improved. We'd love to hear your feedback. Tell us what you think

Activates a file upload.

Basic usage

<adf-upload-button 
    [rootFolderId]="-my-"
    [uploadFolders]="true"
    [multipleFiles]="false"
    [acceptedFilesType]=".jpg,.gif,.png,.svg"
    [versioning]="false"
    (success)="customMethod($event)">
</adf-upload-button>
<adf-file-uploading-dialog></adf-file-uploading-dialog>

Class members

Properties

NameTypeDefault valueDescription
acceptedFilesTypestring"*"Filter for accepted file types.
commentstringWhen you overwrite existing content, you can use the comment field to add a version comment that appears in the version history
disabledbooleanfalseToggles component disabled state (if there is no node permission checking).
majorVersionbooleanfalsemajorVersion boolean field to true to indicate a major version should be created.
maxFilesSizenumberSets a limit on the maximum size (in bytes) of a file to be uploaded. Has no effect if undefined.
multipleFilesbooleanfalseAllows/disallows multiple files
nodeTypestring"cm:content"Custom node type for uploaded file
rootFolderIdstring"-root-"The ID of the root. Use the nodeId for Content Services or the taskId/processId for Process Services.
staticTitlestringDefines the text of the upload button.
tooltipstringnullCustom tooltip text.
uploadFoldersbooleanfalseAllows/disallows upload folders (only for Chrome).
versioningbooleanfalseToggles versioning.

Events

NameTypeDescription
beginUploadEventEmitter<UploadFilesEvent>Emitted when the upload begins.
errorEventEmitter<Object>Emitted when an error occurs.
permissionEventEventEmitter<PermissionModel>Emitted when create permission is missing.
successEventEmitter<Object>Emitted when the file is uploaded successfully.

Details

How to show a notification message for bad permission

You can show a notification error when the user doesn't have the right permission to perform the action. The component emits a permissionEvent when the user does not have delete permission. You can subscribe to this event from your component and use the Notification service to show a message.

<adf-upload-button
    [rootFolderId]="currentFolderId"
    (permissionEvent)="onUploadPermissionFailed($event)">
</adf-upload-button>
export class MyComponent {

    onUploadPermissionFailed(event: any) {
        this.notificationService.openSnackMessage(
            `you don't have the ${event.permission} permission to ${event.action} the ${event.type} `, 4000
        );
    }

}

Upload notification message

See also

Interested in trying Alfresco?

Try Now