Search results

Achieve File Upload Programmatically in Angular Uploader component

03 Aug 2021 / 1 minute to read

You can upload a file programmatically using upload method. The selected files data, get from getFilesData public method in uploader.

The upload method behaves differently based on its arguments.

  • If this method receives any files as arguments, those files only start to upload.
  • If it has no argument then all the selected files are will start to upload.
Copied to clipboard
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { UploaderComponent } from '@syncfusion/ej2-angular-inputs';
selector: 'app-root',
templateUrl: 'default.html',
styleUrls: ['index.css']

export class AppComponent {
public uploadObj: UploaderComponent;
public autoUpload: boolean = false;
public path: Object = {
    saveUrl: '',
    removeUrl: ''
ngAfterViewInit(): void {
    document.getElementById('first').onclick = (args) => {
    document.getElementById('full').onclick = (args) => {
Copied to clipboard
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { UploaderModule } from '@syncfusion/ej2-angular-inputs';

 * Module
    imports: [
        BrowserModule, UploaderModule
    declarations: [AppComponent],
    bootstrap: [AppComponent]
export class AppModule {
Copied to clipboard
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

Copied to clipboard
<div class="control-section">
    <div class="control_wrapper">          
        <ejs-uploader #defaultupload id='fileupload' [asyncSettings]='path' [autoUpload]='autoUpload' ></ejs-uploader>
    <span style=' padding-left: 40px; margin-top: 30px'>
        <button id='first' class='e-btn e-control'>Upload first file</button>
    <span style=' padding-left: 40px; margin-top: 30px'>
        <button id='full' class='e-btn e-control'>Upload all files</button>
Copied to clipboard
#container {
  visibility: hidden;
  margin: 0 auto;
  width: 300px;

#loader {
  color: #008cff;
  font-family: 'Helvetica Neue','calibiri';
  font-size: 14px;
  height: 40px;
  left: 45%;
  position: absolute;
  top: 45%;
  width: 30%;
.control_wrapper {
  max-width: 500px;
  margin: auto;
.e-upload {
  width: 100%;
  position: relative;
  margin-top: 15px;
  margin-bottom: 15px;
.e-upload-actions {
display: none;
.e-btn {
  text-transform: none;

You can also explore Angular File Upload feature tour page for its groundbreaking features. You can also explore our Angular File Upload example to understand how to browse the files which you want to upload to the server.