Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="progress progressbar" style="height:10px;">
- <div class="progress-bar" role="progressbar" [ngStyle]="{ 'width': uploader.progress + '%' }"></div>
- </div>
- <button type="button" class="btn btn-warning btn-s button_gray" (click)="uploader.cancelAll()" [disabled]="!uploader.isUploading">
- <span class="glyphicon glyphicon-ban-circle"></span> Cancel
- </button>
- <button type="button" class="btn btn-danger btn-s button_gray" (click)="uploader.clearQueue()" [disabled]="!uploader.queue.length">
- <span class="glyphicon glyphicon-trash"></span> Remove
- </button>
- <button type="button" class="btn btn-primary btn-s" (click)="uploader.authToken=authToken ;uploader.uploadAll()" [disabled]="!uploader.getNotUploadedItems().length">
- <span class="glyphicon glyphicon-upload"></span> Upload
- </button>
- ngOnInit() {
- this.uploader.onAfterAddingFile = (file) => {
- file.withCredentials = false;
- if (this.target) this.target.value = '';
- };
- this.uploader.onErrorItem = (item, response, status, headers) => this.onErrorItem(item, response, status, headers);
- this.uploader.onSuccessItem = (item, response, status, headers) => this.onSuccessItem(item, response, status, headers);
- }
- let data = JSON.parse(response); //success server response
- console.log(data)
- this.showSnackBar('Successfully Uploaded file.');
- this.router.navigate(['/result'])
- }
- onErrorItem(item: FileItem, response: string, status: number, headers: ParsedResponseHeaders): any {
- let error;
- if (response != undefined && response.length > 0)
- JSON.parse(response); //error server response
- else
- error = response;
- console.log(error)
- this.showSnackBar('Error on Upload the file.');
- }
Add Comment
Please, Sign In to add comment