Gathering detailed insights and metrics for ngx-uploader-file
Gathering detailed insights and metrics for ngx-uploader-file
Gathering detailed insights and metrics for ngx-uploader-file
Gathering detailed insights and metrics for ngx-uploader-file
ngx-awesome-uploader
Angular Library for uploading files with Real-Time Progress bar, File Preview, Drag && Drop and Custom Template with Multi Language support
ngx-uploader
Angular 2+ File Uploader
@openmrs/ngx-file-uploader
angular-uploader
Angular File Upload UI Widget — Lightweight & supports: drag and drop, multiple uploads, image cropping, customization & more 🚀 Comes with Cloud Storage 🌐
npm install ngx-uploader-file
Typescript
Module System
Node Version
NPM Version
TypeScript (77.41%)
SCSS (10.69%)
HTML (8.9%)
JavaScript (3%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
8 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Jun 14, 2025
Latest Version
19.0.2
Package Id
ngx-uploader-file@19.0.2
Unpacked Size
186.05 kB
Size
37.93 kB
File Count
29
NPM Version
11.2.0
Node Version
22.13.0
Published on
Jun 11, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
This is an Angular Library for uploading files. It supports: File Upload and Preview (additionally preview images with lightbox), validation, image cropper , drag and drop with multi language support.
npm install ngx-uploader-file --save
1import { FilePickerModule } from 'ngx-uploader-file'; 2 3@NgModule({ 4 imports: [ 5 ... 6 FilePickerModule 7 ] 8 }) 9
In order to make library maximum compatible with apis you need to create and provide custom adapter which implements upload and remove requests. That's because I have no idea how to get file id in upload response json :) . So this libray exposes a FilePickerAdapter abstract class which you can import on your new class file definition:
import { FilePickerAdapter } from 'ngx-uploader-file';
After importing it to your custom adapter implementation (EG: CustomAdapter.ts), you must implement those 2 methods which are abstract in the FilePickerAdapter base class which are:
public abstract uploadFile(fileItem: FilePreviewModel): Observable<UploadResponse>;
public abstract removeFile(fileItem: FilePreviewModel): Observable<any>;
You can check DEMO adapter here
1<ngx-uploader-file [adapter]="adapter"> </ngx-uploader-file>
1import { HttpClient } from "@angular/common/http"; 2import { DemoFilePickerAdapter } from "./demo-file-picker.adapter"; 3import { Component } from "@angular/core"; 4 5@Component({ 6 selector: "demo-file-picker", 7 templateUrl: "./demo-file-picker.component.html", 8 styleUrls: ["./demo-file-picker.component.scss"], 9}) 10export class DemoFilePickerComponent { 11 adapter = new DemoFilePickerAdapter(this.http); 12 constructor(private http: HttpClient) {} 13}
Note: As you see you should provide http instance to adapter.
Still in Doubt? Check Minimal Setup Demo
1 2/** Whether to enable cropper. Default: disabled */ 3@Input() enableCropper = false; 4 5/** Whether to show default drag and drop template. Default:true */ 6@Input() showeDragDropZone = true; 7 8/** Single or multiple. Default: multi */ 9@Input() uploadType = 'multi'; 10 11/** Max size of selected file in MB. Default: no limit */ 12@Input() fileMaxSize: number; 13 14/** Max count of file in multi-upload. Default: no limit */ 15@Input() fileMaxCount: number; 16 17/** Total Max size limit of all files in MB. Default: no limit */ 18@Input() totalMaxSize: number; 19 20/** Which file types to show on choose file dialog. Default: show all */ 21@Input() accept: string; 22 23/** File extensions filter. Default: any exteion */ 24@Input() fileExtensions: String; 25 26/** Cropper options if cropper enabled. Default: 27dragMode: 'crop', 28aspectRatio: 1, 29autoCrop: true, 30movable: true, 31zoomable: true, 32scalable: true, 33autoCropArea: 0.8 34*/ 35@Input() cropperOptions: Object; 36 37/** Custom Adapter for uploading/removing files. Required */ 38@Input() adapter: FilePickerAdapter; 39 40/** Custom template for dropzone. Optional */ 41@Input() dropzoneTemplate: TemplateRef<any>; 42 43/** Custom Preview Item template. Optional */ 44@Input() itemTemplate: TemplateRef<any>; 45 46/** Whether to show default files preview container. Default: true */ 47@Input() showPreviewContainer = true; 48 49/** Custom validator function. Optional */ 50@Input() customValidator: (file: File) => Observable<boolean>; 51 52/** Custom captions input. Used for multi language support */ 53@Input() captions: UploaderCaptions; 54 55/** Whether to auto upload file on file choose or not. Default: true. You can get files list by accessing component files. */ 56@Input() enableAutoUpload = true; 57 58/** capture paramerter for file input such as user,environment*/ 59@Input() fileInputCapture: string; 60
1 2/** Emitted when file upload via api success. 3Emitted for every file */ 4@Output() uploadSuccess = new EventEmitter<FilePreviewModel>(); 5 6/** Emitted when file upload via api fails. 7Emitted for every file */ 8@Output() uploadFail = new EventEmitter<HttpErrorResponse>(); 9 10/** Emitted when file is removed via api successfully. 11Emitted for every file */ 12@Output() removeSuccess = new EventEmitter<FilePreviewModel>(); 13 14/** Emitted on file validation fail */ 15@Output() validationError = new EventEmitter<ValidationError>(); 16 17/** Emitted when file is added and passed validations. Not uploaded yet */ 18@Output() fileAdded = new EventEmitter<FilePreviewModel>(); 19 20/** Emitted when file is removed from fileList */ 21@Output() fileRemoved = new EventEmitter<FilePreviewModel>();
All validations are emitted through ValidationError event.
To listen to validation errors (in case you provided validations), validationError event is emitted. validationError event implements interface ValidationError and which emits failed file and error type.
Supported validations:
Validation Type | Description | Default |
---|---|---|
fileMaxSize: number | Max size of selected file in MB. | No limit |
fileExtensions: String | Emitted when file does not satisfy provided extension | Any extension |
uploadType: String | Upload type. Values: 'single' and 'multi'. | multi |
totalMaxSize: number | Total Max size of files in MB. If cropper is enabled, the cropped image size is considered. | No limit |
fileMaxCount: number | Limit total files to upload by count | No limit |
You can also provide your own custom validation along with built-in validations.
You custom validation takes file: File
and returns Observable<boolean>
;
So that means you can provide sync and async validations.
public myCustomValidator(file: File): Observable<boolean> {
if (file.name.includes('panda')) {
return of(true);
}
if (file.size > 50) {
return this.http.get('url').pipe(map((res) => res === 'OK' ));
}
return of(false);
}
and pass to Template:
1<ngx-uploader-file [customValidator]="myCustomValidator"> </ngx-uploader-file>
Check Demo
Library uses cropperjs to crop images but you need import it to use it. Example: in index html
1<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.4.3/cropper.min.js" async></script> 2<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.4.3/cropper.css" />
Note: To use cropper, you should set enableCropper to true. Look at API section above.
You can also provide your custom cropper options.
You can provide custom template to library.
I) To provide custom template for drag and drop zone, use content projection. Example:
1<ngx-uploader-file [adapter]="adapter"> 2 <div class="dropzoneTemplate"> 3 <button>Custom</button> 4 </div> 5</ngx-uploader-file>
Note: The wrapper of your custom template must have a class dropzoneTemplate.
II) To use custom file preview template, pass your custom template as below:
1<ngx-uploader-file #uploader [adapter]="adapter" [itemTemplate]="itemTemplate"> </ngx-uploader-file> 2 3<ng-template #itemTemplate let-fileItem="fileItem" let-uploadProgress="uploadProgress"> 4 <p>{{fileItem.file.size}}</p> 5 6 <p>{{fileItem.fileName}}</p> 7 8 <p *ngIf="uploadProgress < 100">{{uploadProgress}}%</p> 9 10 <button (click)="uploader.removeFile(fileItem)">Remove</button> 11</ng-template>
In custom template uploadProgress and fileItem (which implements FilePrevieModel interface) are exposed .
You can add multi language support for library by providing captions object (which implements UploaderCaptions interface).
Check Demo
You can show your files without uploading them
@ViewChild('uploader', { static: true }) uploader: FilePickerComponent;
public ngOnInit(): void {
const files = [
{
fileName: 'My File 1 for edit.png'
},
{
fileName: 'My File 2 for edit.xlsx'
}
] as FilePreviewModel[];
this.uploader.setFiles(files);
}
You can also check out library router animations
You can fork project from github. Pull requests are kindly accepted.
Building library: ng build file-picker --prod
Running tests: ng test file-picker --browsers=ChromeHeadless
Run demo: ng serve
No vulnerabilities found.
No security vulnerabilities found.