Skip to content

Commit aa14d58

Browse files
committed
headers functionality added
1 parent 3a269d4 commit aa14d58

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ npm install angular-file-uploader
3434
```
3535
```javascript
3636
afuConfig = {
37-
uploadAPI: "https://example-file-upload-api"
37+
uploadAPI: {
38+
url:"https://example-file-upload-api"
39+
}
3840
};
3941
```
4042
##### Example-2 ( with all available configuration )
@@ -47,11 +49,17 @@ npm install angular-file-uploader
4749
```
4850
```javascript
4951
afuConfig = {
50-
hideProgressBar: "true",
51-
maxSize: "1",
52-
uploadAPI: "https://example-file-upload-api",
52+
multiple: "false",
5353
formatsAllowed: ".jpg,.png",
54-
multiple: "false"
54+
maxSize: "1",
55+
uploadAPI: {
56+
url:"https://example-file-upload-api",
57+
headers: {
58+
"Content-Type" : "text/plain;charset=UTF-8",
59+
"Authorization" : `Bearer ${token}`
60+
}
61+
},
62+
hideProgressBar: "true"
5563
};
5664
```
5765

@@ -67,7 +75,8 @@ npm install angular-file-uploader
6775
| multiple : boolean | Set it as " true " for uploading multiple files at a time and as " false " for single file at a time. | false |
6876
| formatsAllowed : string | Specify the formats of file you want to upload. | '.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg' |
6977
| maxSize : number | Maximum size limit for files in MB. | 20 MB |
70-
| uploadAPI : string | Complete api url to which you want to upload. | undefined |
78+
| uploadAPI.url : string | Complete api url to which you want to upload. | undefined |
79+
| uploadAPI.headers : {} | Provide headers you need here. | {} |
7180
| hideProgressBar:boolean | Set it as " true " to hide the Progress bar. | false |
7281

7382
---

file-upload.component.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export declare class FileUploadComponent implements OnInit, OnChanges {
1010
uploadAPI: string;
1111
formatsAllowed: string;
1212
multiple: boolean;
13+
headers: any;
1314
idDate: number;
1415
reg: RegExp;
1516
selectedFiles: Array<any>;

file-upload.component.js

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

0 commit comments

Comments
 (0)