So in summary, we've seen that (1), multipart/form-data sends each byte in one byte, aka. it...
sent the "a", the "â˜º", and the "b" to the server, as is.
(2), when we use the application/x-www-form-urlencoded type,
we saw a few things didn't we?
Firstly, we saw that it doesn't have that whole boundary thing,
right, which saves space.
In fact, it uses a single byte boundary per field. Remember each name:value pair is separated by that & symbol.
But, we saw its limitations.
We saw that it adds an overhead factor of three times...
for every non printable character, it's sending more bytes.
(3), we saw that using application/x-www-form-urlencoded cannot send files themselves, only the...
base name of the file. But with the limitations above...
even if we could send files with application/x-www-form-urlencoded, we wouldn't want to because it's
so inefficient, especially when it comes to size.
Imagine it taking your entire file and pretty much, at least tripling its size, because every non printable...
character has to be represented in 3 bytes, not just one.
Woohoo! ðŸ¥³ðŸŽ†
Man.
This is so much fun.
Well done for finishing these lectures, I know it's been tough.
I know it's been pretty advanced.
Not many people get into all of this.
But right now you should have a solid, solid understanding of multipart/form-data, versus the default
encoding type.
And yeah, I guess the bottom line is don't get too overwhelmed. ðŸ˜± If you have a very simple form, only
a few kind of printable characters...
just use the default method.
It's absolutely fine.
In fact, it might even be more efficient because it's not sending all the mimes and the boundary strings...
and all that.
But for larger forms, for forms where you require users to upload an image of themselves, files...
if you're allowing the use of emojis, stick with multipart/form-data. We've just seen that (a) it allows you...
to send files and (b) it does it in a much more efficient way, especially when the size grows because
it doesn't have to represent each non-printable character in the hex format, right. It can send it as is, as
binary.
And the reason it can do all this is because multipart/form-data kind of, you know, it wraps everything...
within this unique boundary string and value.
So, yeah, super, super interesting.
I hope you've learnt a lot.
I just, I can't believe we actually have only just begun in this course.
We've got so much more to learn ðŸ¥³.
So without further ado, let's move on.