Version: 2023.2
LanguageEnglish
  • C#

IMultipartFormSection

interface in UnityEngine.Networking

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An interface for composition of data into multipart forms.

In order to provide a finer level of control for those wishing to generate multipart form data, but without forcing most users to refer to RFC 2388, Unity provides this simple interface which the UnityWebRequest API can use to serialize complex data into properly-formatted bytes.

For convenience, the two general types of form sections have been encapsulated into two stock implementations of IMultipartFormSection. Both stock implementations are simply controlled via their constructors.

IMultipartFormSection implementors are converted into bytes via [UnityWebRequest.SerializeFormSections].

Additional resources: [MultipartFormDataSection], [MultipartFormFileSection].

Properties

contentTypeReturns the value to use in the Content-Type header for this form section.
fileNameReturns a string denoting the desired filename of this section on the destination server.
sectionDataReturns the raw binary data contained in this section. Must not return null or a zero-length array.
sectionNameReturns the name of this section, if any.