How to Achieve Folder Upload in Angular File Manager Component?
Follow these steps to enable folder upload in the Angular File Manager component using an external drag and drop action:
Step 1: Implement the File Manager Component
Begin by setting up the File Manager component in your Angular application. Follow the Getting Started documentation to install the necessary dependencies and configure the File Manager setup.
Step 2: Enable Folder Upload through External Drag and Drop
To allow folder uploads using external drag and drop action, set the directoryUpload property to true in the uploadSettings object.
<ejs-filemanager
id="file"
#fileObj
[ajaxSettings]="ajaxSettings"
[uploadSettings]="uploadSettings"
></ejs-filemanager>
import { FileManagerComponent, FileManagerModule } from '@syncfusion/ej2-angular-filemanager';
....
export class AppComponent {
@ViewChild('fileObj')
public fileObj: FileManagerComponent;
public ajaxSettings: object;
public uploadSettings?: object;
public hostUrl: string = 'https://ej2-aspcore-service.azurewebsites.net/';
public ngOnInit(): void {
this.ajaxSettings = {
url: this.hostUrl + 'api/FileManager/FileOperations',
getImageUrl: this.hostUrl + 'api/FileManager/GetImage',
uploadUrl: this.hostUrl + 'api/FileManager/Upload',
downloadUrl: this.hostUrl + 'api/FileManager/Download',
};
// Enable folder upload via drag and drop
this.uploadSettings = { directoryUpload: true };
}
}
Sample: FileManager-FolderUpload
See Also:
Conclusion
I hope you enjoyed learning how to achieve folder upload in Angular File Manager Component.
You can refer to our Angular File Manager feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular File Manager example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!