Guest User

Untitled

a guest
Mar 18th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <input type="file" (change)="handleUpload($event)">
  2.  
  3. handleUpload(event) {
  4. const file = event.target.files[0];
  5. const reader = new FileReader();
  6. reader.readAsDataURL(event);
  7. reader.onload = () => {
  8. console.log(reader.result);
  9. };
  10. }
  11.  
  12. ERROR TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
  13. at _global.(anonymous function).(anonymous function) [as readAsDataURL] (webpack-internal:///./node_modules/zone.js/dist/zone.js:1323:60)
  14. at AccountFormComponent.handleUpload (account-form.component.ts:212)
  15. at Object.eval [as handleEvent] (AccountFormComponent.html:344)
  16. at handleEvent (core.js:13547)
  17. at callWithDebugContext (core.js:15056)
  18. at Object.debugHandleEvent [as handleEvent] (core.js:14643)
  19. at dispatchEvent (core.js:9962)
  20. at eval (core.js:10587)
  21. at HTMLInputElement.eval (platform-browser.js:2628)
  22. at ZoneDelegate.invokeTask (zone.js:421)
Add Comment
Please, Sign In to add comment