1
00:00:00,940 --> 00:00:01,930
In this video.

2
00:00:01,930 --> 00:00:08,400
We are going to fix this error if the user is not updating a post with the image.

3
00:00:08,410 --> 00:00:09,460
So let's see.

4
00:00:09,580 --> 00:00:11,710
Let's get back to the controller.

5
00:00:11,710 --> 00:00:19,330
So the logic that we are going to use here is that we are going to check if the user is updating the

6
00:00:19,330 --> 00:00:20,380
image in that way.

7
00:00:20,380 --> 00:00:27,230
We go ahead and use the image properly and use the image got back from ordinary.

8
00:00:27,250 --> 00:00:33,100
Otherwise, we are not going to allow the user to update the image field.

9
00:00:33,100 --> 00:00:35,010
So how are we going to check?

10
00:00:35,020 --> 00:00:38,800
So first check is like this as check.

11
00:00:38,830 --> 00:00:50,530
If the user is updating image, it's going to be as if on the rec dot file, meaning if you have a property

12
00:00:50,530 --> 00:00:57,310
on the request called file, then it means that the user is updating the image as well.

13
00:00:57,310 --> 00:01:03,760
So I would copy this one and place it inside here else.

14
00:01:06,100 --> 00:01:08,980
The same logic cut from here, please.

15
00:01:08,980 --> 00:01:09,340
Here.

16
00:01:09,340 --> 00:01:11,560
And remove the image from here.

17
00:01:11,770 --> 00:01:15,410
For this one I don't want to send back the post being updated.

18
00:01:15,430 --> 00:01:17,650
If you want to send it back you can do that.

19
00:01:17,650 --> 00:01:19,810
So I'm going to remove it as that.

20
00:01:20,050 --> 00:01:22,180
So let's try again.

21
00:01:22,180 --> 00:01:23,650
Let's refresh it.

22
00:01:24,040 --> 00:01:25,510
Let me go back home.

23
00:01:30,520 --> 00:01:36,570
So let me change this 1 to 3 and I'm going to update without providing image.

24
00:01:36,580 --> 00:01:37,390
So let's see.

25
00:01:38,720 --> 00:01:43,190
And you can see that it worked fine without the image being tampered.

26
00:01:43,340 --> 00:01:48,920
And if I want to update the image also, I can go ahead and do that.

27
00:01:48,920 --> 00:01:54,790
I want to change this one to CSS for testing purposes and for the image I want.

28
00:01:54,830 --> 00:01:56,690
Use this image.

29
00:01:57,960 --> 00:02:01,500
And you can see that it has been updated successfully.

30
00:02:01,530 --> 00:02:02,670
All right.

31
00:02:02,910 --> 00:02:07,190
So what has left is about the comment.

32
00:02:07,200 --> 00:02:12,030
So on each page, you want to add a comment to the post.

33
00:02:12,030 --> 00:02:15,570
So let's see how we are going to implement the one in the next video.

