Fireship · @fireship

AngularFire2 Storage - File Upload Dropzone

Uploaded January 26, 2018 · Length 11:18

AngularFire2 Storage -  File Upload Dropzone

Summary

angularfire2 storage file upload dropzone tutorial

  • angularfire2 storage
  • file upload
  • dropzone
  • angular directive
  • firebase storage
  • angular tutorial

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    [Music]

  2. 0:01

    fire base storage is now officially

  3. 0:04

    supported by angularfire 2 which means

  4. 0:06

    uploading files from an angular

  5. 0:08

    application is easier than ever before

  6. 0:10

    in this episode I'm going to take you

  7. 0:12

    through the new features in the

  8. 0:13

    angularfire 2 storage module then we'll

  9. 0:16

    use it to build a drop zone file

  10. 0:18

    uploader from scratch in addition to

  11. 0:20

    uploading files to firebase storage it

  12. 0:22

    can also control the entire upload

  13. 0:24

    process by pausing canceling or resuming

  14. 0:27

    an upload

  15. 0:28

    there's a whole bunch of other cool

  16. 0:29

    stuff I want to show you but first make

  17. 0:31

    sure to LIKE and subscribe and grab the

  18. 0:33

    source code from angular firebase com

  19. 0:36

    before we jump into the code I want to

  20. 0:38

    give you a few more details about how

  21. 0:39

    the angularfire 2 storage module works

  22. 0:42

    when we drag and drop a file it's going

  23. 0:44

    to start an angular fire upload task

  24. 0:46

    which will immediately start uploading

  25. 0:48

    the file to your firebase storage bucket

  26. 0:50

    you can then monitor the upload progress

  27. 0:52

    as an observable the snapshot is emitted

  28. 0:55

    several times per second so you can do

  29. 0:57

    things like update your progress bar or

  30. 0:59

    just provide the user with some helpful

  31. 1:00

    feedback when the process is complete it

  32. 1:03

    will give you back the download URL that

  33. 1:05

    you can show in your front-end UI now

  34. 1:07

    let's go ahead and build this thing

  35. 1:08

    we'll start with a brand new angular 5

  36. 1:10

    app and then inside that project install

  37. 1:12

    angularfire 2 and firebase then inside

  38. 1:15

    of your angular environment add your

  39. 1:17

    firebase project config and lastly we'll

  40. 1:20

    go into the app module and initialize

  41. 1:22

    our angular fire app I am bringing in

  42. 1:25

    both the angular fire storage module and

  43. 1:27

    the fire store database for some

  44. 1:29

    advanced stuff I'll show you towards the

  45. 1:30

    end of the video now that we have

  46. 1:32

    angular fire to set up we need a way to

  47. 1:33

    retrieve a file from the user's device

  48. 1:35

    into our angular app we want the user to

  49. 1:38

    drag and drop a file which is a perfect

  50. 1:40

    use case for an angular directive we

  51. 1:43

    want to use this directive on an HTML

  52. 1:45

    element and have it emit custom events

  53. 1:48

    based on certain drag-and-drop activity

  54. 1:50

    we can create custom events an angular

  55. 1:52

    by using a combination of host listener

  56. 1:54

    output and event emitter the first thing

  57. 1:58

    we do is create our custom events which