Welcome back.
Let's get started with file upload.
Unlucky for us by default, express does not support file upload.
That is for data and we can configure Express to accept what is called form data.
Until this point, all the data that we sent our server are all JSON data like texts.
So how are we going to send files to our server?
Good.
And lucky for us we have a package called Morta and we are going to use more to package to be able to
allow express to accept for data.
By the end of this section, this is a project that we are going to create.
We will allow a user to be able to upload image from their browser and also fetch all images.
So let's get started.
The first step is I will show you how we can use Postman or create the API to upload images.
And after that I will show you how we can use the form also to upload images and I'm going to show you
two ways of uploading images.
First is we are going to learn how we can use motor to upload images onto the file system and then after
that we go ahead and use Cloud Neri and save images into Cloud Neri.
So let's get started with motor before we continue.
I have provided a sample project for you with some starter code and I work through the folders here.
So if you open the config, you can see that this is a configuration for our MongoDB connection and
for this one we have talked about it before and I have given you my free connection string, but I can
change it at any time.
I'm advising you to use your own connection string and when you get back to Cloud Neri, we are going
to save the strings into our MongoDB.
That is why we have this function to connect to MongoDB.
And then inside the model, that's where we are going to save the images into our database inside the
public container, the CSS for the project.
And then the view is contains the templates and purchase content, the navigation links for this once
we have covered them in details and if you open the server file, that's where we are going to write
the code where I made a mistake to add this one so you can go ahead and delete this file called Indexed
or HTML.
We don't need it.
We are going to work on the server dot js file so make sure that everything is correct.
So open your terminal and start the server to make sure that everything is working.
Then we can get started.
All right.
You can see that the server is up and running the next video.
Let's get started with the file upload.