I have a webcam so i need to capture a ID card and uploading the image for my angular project. anybody suggest me the simple npm library for do it.
Asked
Active
Viewed 56 times
2
-
[ng file upload](https://www.npmjs.com/package/ng-file-upload) – jitender Oct 03 '19 at 07:38
-
you basically don't need a library too, just sending file like regular upload will do – Joel Joseph Oct 03 '19 at 07:40
-
https://stackoverflow.com/questions/45160884/file-upload-and-download-in-angular-4-typescript – Joel Joseph Oct 03 '19 at 07:42
1 Answers
2
use formData upload like the method below:
public upload(file: any): Observable<any> {
let headers: HttpHeaders = new HttpHeaders();
const params = new HttpParams();
const formData: FormData = new FormData();
if (file) {
formData.append('file', file, file.name);
}
return this.http.put(this.Url, formData, { headers, params })
.pipe(map((response: any) => {
return response;
}));
}

Ali Keserwan
- 217
- 1
- 4