So far all the data that we've been sending to the server about our videos has just been simple string metadata, but what do we do when we actually want to send the video data itself which might be hundreds of megabytes or gigabytes even. And we want to send this data to the server and have it stored or do something with it. How do we go about doing that? Well all of the request that we've been sending and, and operating on so far have just been simple request where either the parameters were provided in a query string or they were URL encoded into the request body. But for really large sets of binary data, things like video data that we're uploading, we don't want to use a URL encoded form body. What we want to use is a multi-part request. We want to have the body of our HTTP request that we're sending be multipart encoded. Now, what this means is, is that our server side has to understand how to accept multipart data, and this is easy to do with the controllers that we've been writing. So let's take a look at how we do this. So let's say we go back to our video service controller. So we have our video service and it's got all of the nice spring annotations on it and we want to accept a video. So let's say we have a new method which is public you know, maybe we'll return a [UNKNOWN] or something else. [BLANK_AUDIO] Upload video. So we got our request mapping up here just like we normally would, we've got a request, or response body mapping for what we're returning. And we want to an accept a parameter that is going to be the actual binary data for the video. What we can do, is we can add a parameter, a request param, [BLANK_AUDIO] for, the video, let's call it Data, and we can set its type to Multipart File. And we'll call this Video Data. And what this parameter is is when you send a multipart request, it doesn't make sense, always, to process that request in the same way that you did for simple string data. It doesn't make sense to necessarily load it all in the memory, and then process it in memory. You probably want to, you know, stream that data in from the client and stream it to disk as you're receiving it from the client, or do something similar to it. You don't want to load a multi gigabyte video into memory necessarily and then wait til it's all done and then save it to disk. It is using up a lot of memory. You probably want to read it as you're getting it and save it, or read it as you're getting it and process it in some way. So that's what the multipart file type gives us is the ability to, begin streaming and doing something with the data. So that we're not just loading huge things in the memory necessarily and doing something with them. So, what we do is we get this just as a request param, just like we normally would. We just declare it's typed to the Multipart File. And if you want to do accept Multiple Parameters, you can just make this an array of Multipart Files. And then in our method what we're going to do is we can get an input stream. And you should be familiar with input streams if you have worked with java. From the file, so we can say video data get input stream, and we can obtain an input stream from this video data. And then we can go off and do something with it, like save it to disk, or to a database or whatever we're doing. Sending it or streaming it to another client, whatever we want to do. And so the multi part file is our connection to grab an input string from that video data. We can also get the actual file name that was provided by the client, for that data from the multipart file element that we're provided as a parameter. But this is what gives us the hook into that data that's coming in from the client, and allows us to grab a stream and process it and do something with it. And also to provide, get access to the metadata that the client may have provided about the video, like it's name. The second thing that you need to do to enable multipart uploads to your controllers is to configure a multipart configuration in your application so that Spring knows that you're expecting multipart data and you want to handle it. And also to tell us some information it needs to now about how big you expect these request to be at maximum. And other things like that that help us decide is the client trying to upload too much data and attack me, or is what they're doing legitimate? So, in order to enable this, in your application class, where you have your configuration, you need to add a new bean. And, later, we're going to talk about what these beans are doing. But for now, just understand that when you want to accept multipart data, this is what you have to do. You need to add a method that returns a multipart config element, and we'll just call this method get multipartconfig. And it is going to take no arguments, and it's going to be annotated with at bean. Now what this app beam does, and you'll learn about it later when we talk about dependency injection, is it tells spring that this is some piece of configuration information that it needs to know about. And to go and call this method, get this thing back, and then go and use that configuration information. In this case use the thing that's being returned for a multi part config element to configure part of the application. What this multi part config element's going to have is information about what you expect from the multi part request. So, what we do is we say multipart config factory. F equals, and we construct a new one of theses. And then we can do things like say f.setmaxfilesize, and we can provide some size like 2000 bytes or whatever it is that you want to limit the upload size to be. This will set the maximum file size that we want to accept, but, a request could potentially have more than one file in it. So, we may also want to set a limit on the total size of any HTTP requests that we receive. So we could say f.set max request size, and provide a value for it as well. Finally, we just return f.create multipartconfig, and Spring will go and take the information you told it about, max file size, and request size, and other parameters, create multipart configuration that can then be used to decide what multipart data is accepted, how much, how big the request can be, and all of those other types of things. Now, if this code seems a little bit boilerplate and you're worried about remembering all of it. Don't worry. We've got code samples, so, how you can set up multipart config in your application. And the, the truth is, is that this is pretty much the same. All you end up doing is needing to know about configuring these two things, but the rest of this is pretty much the same. Any time you want to accept multipart data like video data that you're uploading, you need to add this block to your application. You'll want to add an add bin annotated method that returns of multipart config element. And, probably even a better name for this would be multipartconfig with a lower case m rather than get multipart config. And we'll talk about how we do dependency injection and how this is actually used later on. But for now just know that if you want to accept multipart data, add this to your config, and this block is pretty much the same across all the applications. You just go and add it to your configuration for your application and Spring will pick it up and begin accepting multi part requests from clients.