FileElement MultipartBoundary Property C# API
Gets or sets the string that will be used as the boundary between files (including the -- prefix), when encoding this element as multipart/form-data.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.5.77 (1.0.0.0)
Syntax

public string MultipartBoundary { get; set; }

Field Value

The string that will be used as the boundary between files (including the -- prefix), when encoding this element as multipart/form-data.
Examples

The following example demonstrates setting the multipart file boundary.
// Populate form with data
Form form = previousResponse.ExtractForm("myForm");
form.GetInputElement("input1").Value = "value1";
form.GetFileElement("files-to-upload[]").AddFile("image.bmp", @"C:\dataFiles\image.bmp", "image/bmp");
form.GetFileElement("files-to-upload[]").AddFile("image2.bmp", @"C:\dataFiles\image2.bmp", "image/bmp");

// Set the multipart boundary for the FileElement
form.GetFileElement("files-to-upload[]").MultipartBoundary = "--multipart-file-boundary";

// Send the POST request
Request request = WebBrowser.CreateRequest(HttpMethod.POST, myUrl);
request.SetMessageBody(form);
Response response = request.Send();
Examples

The following example demonstrates the contents of the POST request sent in the previous example.
--multipart-form-boundary
Content-Disposition: form-data; name="input1"

value1
--multipart-form-boundary
Content-Disposition: form-data; name="files-to-upload[]"
Content-Type: multipart/mixed; boundary=multipart-file-boundary

--multipart-file-boundary Content-Disposition: file; filename="image.bmp" Content-Type: image/bmp (binary image data)
--multipart-file-boundary Content-Disposition: file; filename="image2.bmp" Content-Type: image/bmp (binary image data)
--multipart-file-boundary-- --multipart-form-boundary--
Examples

The following example demonstrates getting the multipart file boundary.
form.GetFileElement("files-to-upload[]").MultipartBoundary;
// This will return "--multipart-file-boundary"
See Also