Skip to content

Commit 06968ae

Browse files
committed
first commit
0 parents  commit 06968ae

14 files changed

+400
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Angular file uploader is an Angular 2+ file uploader module with real-time progress bar and Angular Universal Compatibility.
2+
3+
###Install
4+
```
5+
npm install angular-file-uploader
6+
```
7+
###Usage
8+
- Bootstrap.min.css is required.
9+
Include
10+
```html
11+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
12+
```
13+
in your index.html.
14+
- Import FileUploadModule inside your app.module.ts
15+
```javascript
16+
import { FileUploadModule } from "angular-file-uploader";
17+
```
18+
```javascript
19+
@NgModule({
20+
imports: [
21+
...,
22+
FileUploadModule,
23+
...
24+
]
25+
})
26+
```
27+
#####Example-1
28+
```html
29+
<angular-file-uploader
30+
[uploadAPI]="'https://example-file-upload-api'">
31+
</angular-file-uploader>
32+
```
33+
#####Example-2
34+
```html
35+
<angular-file-uploader
36+
[multiple]="true"
37+
[formatsAllowed]="'.jpg,.png'"
38+
[maxSize]="5"
39+
[uploadAPI]="'https://example-file-upload-api'"
40+
[resetUpload]=resetUpload
41+
(ApiResponse)="DocUpload($event)">
42+
</angular-file-uploader>
43+
```
44+
45+
| **Properties** | **Description** | **Default Value** |
46+
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
47+
| multiple : boolean | true- multiple file upload. false- single file upload | false |
48+
| formatsAllowed : string | specify the formats of file you want to upload. | '.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg' |
49+
| uploadAPI : string | complete api url to which you want to upload. | undefined |
50+
| maxSize : number | maximum size limit for files in MB. | 20 |
51+
| ApiResponse : EventEmitter | assign one custom function ,for example " DocUpload($event) " here where " $event " will contain the response from the api. | |
52+
| resetUpload : boolean | give it's value as " true " whenever you want to clear the list of uploads being displayed. It's better to assign one boolean variable (resetUpload here)to it and then change that variable's value. | false |
53+
54+
#####Points to note:
55+
- Set resetUpload as true to reset the module instantly.
56+
Remember to change resetUpload value 'true' to 'false' after every reset.
57+
- ApiResponse will return the response it gets back from the uploadAPI.
58+
- Files are uploaded in FormData format.
59+
60+
###Coming Soon:
61+
- Multiple themes.
62+
- Drag n Drop.
63+
- More customization options.

file-upload.component.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { OnInit, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2+
export declare class FileUploadComponent implements OnInit, OnChanges {
3+
multiple: boolean;
4+
formatsAllowed: string;
5+
uploadAPI: string;
6+
maxSize: number;
7+
ApiResponse: EventEmitter<{}>;
8+
resetUpload: boolean;
9+
theme: string;
10+
idDate: number;
11+
id: number;
12+
reg: RegExp;
13+
selectedFiles: Array<any>;
14+
notAllowedList: Array<Object>;
15+
Caption: Array<string>;
16+
singleFile: boolean;
17+
progressBarShow: boolean;
18+
uploadBtn: boolean;
19+
uploadMsg: boolean;
20+
afterUpload: boolean;
21+
uploadClick: boolean;
22+
uploadMsgText: string;
23+
uploadMsgClass: string;
24+
percentComplete: number;
25+
constructor();
26+
ngOnChanges(rst: SimpleChanges): void;
27+
ngOnInit(): void;
28+
onChange(event: any): void;
29+
uploadFiles(): void;
30+
removeFile(i: any, sf_na: any): void;
31+
convertSize(fileSize: number): string;
32+
attachpinOnclick(): void;
33+
}

file-upload.component.js

Lines changed: 230 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

file-upload.component.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)