Sending and receiving binary data web apis
The following example sends creates a text file on-the-fly and uses the POST method to send the "file" to the server. Sep 22, Not all browsers support this for HTML forms, but you create this format in script as follows:. You can also send binary content by passing an instance of the nsIFileInputStream to send. That's because we process the request body inside the sending and receiving binary data web apis, without invoking a media-type formatter.
First, in the controller, you must decorate the parameter name with the FromBody attribute. Use this format if you are uploading a file to the server. Please, read this paragraph.
The following example sends creates a text file on-the-fly and uses sending and receiving binary data web apis POST method to send the "file" to the server. This tells the browser not to parse it, and to let the bytes pass through unprocessed. Part 1 of this article looks at x-www-form-urlencoded format. The jQuery submit function replaces the form action with a new function. In the previous sections, we sent a complex type, which Web API deserialized to an instance of a model class.