WEBVTT

0
00:04.760 --> 00:13.340
So in summary, we've seen that (1), multipart/form-data sends each byte in one byte, aka. it...

1
00:13.340 --> 00:17.540
sent the "a", the "â˜º", and the "b" to the server, as is. 

2
00:17.660 --> 00:21.040
(2), when we use the application/x-www-form-urlencoded type, 

3
00:21.680 --> 00:23.060
we saw a few things didn't we?

4
00:23.630 --> 00:26.030
Firstly, we saw that it doesn't have that whole boundary thing,

5
00:26.210 --> 00:27.590
right, which saves space.

6
00:27.740 --> 00:34.550
In fact, it uses a single byte boundary per field. Remember each name:value pair is separated by that & symbol. 

7
00:34.940 --> 00:36.370
But, we saw its limitations.

8
00:36.380 --> 00:40.400
We saw that it adds an overhead factor of three times...

9
00:40.700 --> 00:44.030
for every non printable character, it's sending more bytes.

10
00:44.960 --> 00:51.620
(3), we saw that using application/x-www-form-urlencoded cannot send files themselves, only the...

11
00:51.620 --> 00:55.400
base name of the file. But with the limitations above...

12
00:55.400 --> 01:01.610
even if we could send files with application/x-www-form-urlencoded, we wouldn't want to because it's

13
01:01.610 --> 01:04.130
so inefficient, especially when it comes to size.

14
01:04.380 --> 01:13.250
Imagine it taking your entire file and pretty much, at least tripling its size, because every non printable...

15
01:13.250 --> 01:16.400
character has to be represented in 3 bytes, not just one.

16
01:17.760 --> 01:18.680
Woohoo! ðŸ¥³ðŸŽ†

17
01:21.890 --> 01:22.230
Man.

18
01:24.090 --> 01:24.960
This is so much fun.

19
01:25.140 --> 01:28.300
Well done for finishing these lectures, I know it's been tough.

20
01:28.320 --> 01:29.410
I know it's been pretty advanced.

21
01:29.430 --> 01:30.900
Not many people get into all of this.

22
01:31.290 --> 01:36.870
But right now you should have a solid, solid understanding of multipart/form-data, versus the default

23
01:36.870 --> 01:37.560
encoding type. 

24
01:37.680 --> 01:43.040
And yeah, I guess the bottom line is don't get too overwhelmed. ðŸ˜± If you have a very simple form, only

25
01:43.050 --> 01:45.150
a few kind of printable characters...

26
01:45.690 --> 01:47.800
just use the default method.

27
01:48.180 --> 01:49.740
It's absolutely fine.

28
01:49.980 --> 01:55.470
In fact, it might even be more efficient because it's not sending all the mimes and the boundary strings...

29
01:55.470 --> 01:55.980
and all that.

30
01:56.610 --> 02:03.140
But for larger forms, for forms where you require users to upload an image of themselves, files...

31
02:03.330 --> 02:09.870
if you're allowing the use of emojis, stick with multipart/form-data. We've just seen that (a) it allows you...

32
02:09.870 --> 02:15.510
to send files and (b) it does it in a much more efficient way, especially when the size grows because

33
02:15.510 --> 02:21.750
it doesn't have to represent each non-printable character in the hex format, right. It can send  it as is, as

34
02:21.750 --> 02:22.220
binary.

35
02:22.680 --> 02:28.560
And the reason it can do all this is because multipart/form-data kind of, you know, it wraps everything...

36
02:28.560 --> 02:31.600
within this unique boundary string and value.

37
02:32.310 --> 02:34.380
So, yeah, super, super interesting.

38
02:34.380 --> 02:35.190
I hope you've learnt a lot. 

39
02:36.420 --> 02:39.210
I just, I can't believe we actually have only just begun in this course. 

40
02:39.210 --> 02:40.240
We've got so much more to learn ðŸ¥³.

41
02:41.010 --> 02:44.000
So without further ado, let's move on.