Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Method: MultipartFormDataHelper.MultipartFileStream AddFile(string, string, string)

Declaration

public MultipartFormDataHelper.MultipartFileStream AddFile(
    string name,
    string filename,
    string contentType = "application/octet-stream"
)

Summary

Adds a named file (or, generally, a binary data field) to the POST request.

Parameters

stringname The name of the value to add. For maximum compatibility with servers, use only printable ASCII characters in this name. This field is encoded using UTF-8, which is supported by some modern servers, but not by others.
stringfilename The filename to use. The server may interpret this as it pleases, but this value will often end up being exposed as the name of the uploaded file. For maximum compatibility with servers, use only printable ASCII characters in this name. This field is encoded using UTF-8, which is supported by some modern servers, but not by others.
stringcontentType The content type to specify for this data/file. Some servers decide whether to accept or reject an upload based on the content type. Specify null to prevent the inclusion of the Content-Type header.

Returns

A stream into which the binary data is to be written. You may close this stream when done, but if you don't, it will be closed automatically next time you add a field or a file, or if you call MultipartFormDataHelper.GetResponse() (which prevents further writing).