Guest User

Untitled

a guest
Mar 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. percentageArray = [];
  2.  
  3. startUpload(event: FileList) {
  4.  
  5. Array.from(event).forEach(file => {
  6. if (file.type.split('/')[0] != 'image') {
  7. alert('Dieses Dateiformat wird nicht unterstützt');
  8. }
  9.  
  10. // Storage path
  11. const path = `uploads/${this.currentUserEmail}/${this.uniqueID}/${file.name}`;
  12.  
  13. // Meta Data
  14. const customMetadata = {
  15. auctionID: this.uniqueID.toString()
  16. }
  17.  
  18. // Main Task
  19. this.task = this.storage.upload(path, file, {customMetadata});
  20.  
  21. // Progress Monitoring
  22.  
  23. this.percentage = this.task.percentageChanges();
  24. this.percentage.subscribe(p => {
  25. this.percentageArray.push(p);
  26. })
  27.  
  28. this.snapshot = this.task.snapshotChanges();
  29.  
  30. // File Download Url
  31. this.downloadURL = this.task.downloadURL();
  32.  
  33. this.imgArray.push(path);
  34.  
  35. })
  36. }
  37.  
  38. <div *ngIf="percentageArray as item" class="w-100">
  39. <div *ngFor="let elem of item">
  40. <ngb-progressbar type="info" [value]="elem" [striped]="true" [max]="100" [showValue]="true"></ngb-progressbar>
  41. </div>
  42. </div>
Add Comment
Please, Sign In to add comment