Fireship · @fireship
Multiple Concurrent File Uploads with Firebase Storage + Angular
Uploaded February 20, 2019 · Length 8:44
Summary
Build a drop zone file uploader in Angular that handles multiple concurrent files to Firebase Storage.
- angular file upload
- firebase storage upload
- concurrent file upload
- angular directive
- drop zone file uploader
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
when I first got started in web
- 0:07
development cloud storage buckets were a
- 0:09
relatively new technology and getting
- 0:11
user generated files uploaded to the
- 0:13
cloud was a major pain point but luckily
- 0:15
today we have firebase which makes this
- 0:16
process much easier but just as flexible
- 0:18
for the developer in today's video
- 0:20
you'll learn how to build a drop zone
- 0:21
style file uploader in angular that can
- 0:23
handle multiple concurrent files to
- 0:25
firebase storage if you're new here like
- 0:27
and subscribe and grab the full source
- 0:29
code from fire ship IO I created a
- 0:31
similar video about a year ago but the
- 0:33
number one request has been a system
- 0:34
that handles multiple files concurrently
- 0:36
so in this demo you can drop as many
- 0:38
files as you want onto the drop zone and
- 0:40
then you can pause or cancel each
- 0:41
individual upload the cool thing is that
- 0:43
firebase will handle all the concurrency
- 0:45
under the hood so you can have your
- 0:46
users drop as many files as you want
- 0:48
here and firebase will choose the best
- 0:49
strategy to get those files uploaded to
- 0:51
the cloud which is based mostly on the
- 0:52
user's network connection and another
- 0:54
thing we'll do is save the download URL
- 0:56
to this file in fire store this makes it
- 0:59
really easy to access the raw file if
- 1:00
you're already using fire store in other
- 1:02
parts of your application now I'm going
- 1:04
to show you how to build the drop zone
- 1:06
from scratch and angular but one thing
- 1:07
you should check out is this custom file
- 1:09
drop element from google chrome labs it
- 1:11
has nothing to do with angular
- 1:12
but because web components are awesome
- 1:14
you can just drop it into your angular
- 1:15
app and start using it so this might be
- 1:17
a good alternative for building your own
- 1:18
custom drop zone let's go ahead and get
- 1:20
started first I'm assuming that you have
- 1:22
an angular app along with angular fire
- 1:24
and firebase installed if we take a look
- 1:26
at the app module you can see I have
- 1:27
angular fire storage and fire store and
- 1:30
if we take a look at the CSS for this
- 1:32
application we have a drop zone class
- 1:34
which is just a flexbox with a border
- 1:36
then we have a hovering class that will
- 1:38
change the border from dash to solid
- 1:40
when the user hovers over the box and
- 1:41
all the other styles come from a
- 1:43
framework called bulma which if you're
- 1:44
not familiar with is a cool alternative
- 1:46
to bootstrap or material the first thing
- 1:48
we'll do is generate a directive that
- 1:50
will be able to turn any div into a drop
- 1:52
zone and by drop zone I just mean an
- 1:54
area that the user can drag and drop
- 1:56
files to and then we can receive those
- 1:58
files as an event in our web application


