Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. uploadFile(event) {
  2. const file = event.target.files[0];
  3. if (this.validateFile(file)) {
  4. this.isUploadInprogress = true;
  5. const formData: FormData = new FormData();
  6. formData.append('files', file, file.name);
  7.  
  8. this.uploadService
  9. .uploadFile(formData)
  10. .subscribe(
  11. uploadResponse => this.uploadSuccess(uploadResponse, file),
  12. error => (this.isUploadInprogress = false)
  13. );
  14. } else {
  15. this.invitationsService.showError('Please upload valid file');
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement