Hi everyone.
Actually, I already told you we don't need to upload media or remove file.
But I think the best way is show you how to do that.
Okay, so let me open the upload file.
After we save into the database, we need to emit the event.
Right.
Let me show you how we can do that.
We need to call this dot.
Most did.
Why?
Not handle apply media.
Okay.
Something like this.
And right now what we need to put right here we are.
We need to put entirely apply media literal.
And the ID okay.
So it will be the id and the second parameter is the ratio we want to upload us, right?
Well, in the front end we need to base on the ID of the post right here.
And we need to append this detail into the.
Post with this ID right.
Okay, I hope you already know how we can handle it right now.
Okay.
So if not, let me explain.
111 more time.
Firstly for sure in the in the front end we will have a state with a message.
Right?
So we have a state with a message.
We will some ID.
Okay.
With a message like sorry with a boss or something like that over here with the ID.
Okay.
By on this article here we need to find the object.
And by object we need to create the media file.
And this includes media file.
Okay.
Something like that.
Right.
So I hope you're very clear about that.
Let me create a handle upload media right here.
Let's open the box gateway.
And the first one will be boss ID right screen.
And the second one is a block many editors, which is.
Exactly.
The structure over here.
Right.
Make sure we pop that.
And right here let a media event Several.
Not a big.
Boss.
But he was okay.
And.
I need to put the object with the boss away and upload the details over here.
Or we can send Maria.
Bice.
Okay.
With the upload modality of.
Okay.
Let me double check my files over here.
Okay.
Now let me console.log.
Let me copy this array okay.
And open the block media and change the array.
And now with the body right here I will set exactly the same structure and make sure we stay in that.
Okay.
And let me say now we already got the message.
Let me check right here.
We already got the boss and block media.
Okay.
Very cool.
Right.
And one more thing.
We Please remove media files.
Let me open this to say how we can do that.
If you check the delete media radio, we only need to know what's in the media and what's in the media.
This is for sure will be the public ID of media file, right?
So for that reason, in this case I remove this dot mod z y dot handle.
Remove.
Media.
The first one will be for sure.
We unwind this the bus array.
Right.
And the second one we will use the in.
The media ID right.
I will send back over here media right And based on this idea in the front end, we need to filter out
the object based on this idea over here.
Right?
So that's all what we need.
And let me create us.
Hello.
Firebase Maria.
Hello.
Okay.
Let us and let God sort of.
Let me copy this idea of the boss.
Over here please.
Boris, let me get on the boss again.
Inside the new boss.
Okay.
And over here I will cope with the opiate addict.
Okay.
And over here.
And let me say, we got the message.
Success.
And we already got the boss and media with exactly the same over here and on the front end.
We need to filter out right now the jackpot for that.
So we are already done with the upload media and remove media.
So I hope you understand this video and I will see you in the next.