FreeFlow class library

AttachmentField Class

An attachment field.

For a list of all members of this type, see AttachmentField Members.

System.Object
   FreeFlow.Client.Connectable
      FreeFlow.Client.Field
         FreeFlow.Client.AttachmentField

[Visual Basic]
Public Class AttachmentField
    Inherits Field
[C#]
public class AttachmentField : Field

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

The following example shows how to attach a file to an attachment field on a form. This assumes the use of a HtmlInputFile ASP.NET control, but you could use any Stream-based data. The example assumes there is a map called 'Map1' with a creation action called 'First action' that uses a form with an attachment field called 'attach'.

[C#]
Connection conn = new Connection(); 
ActionPage page = new ActionPage(); 
conn.Login("username", "password"); 
page.Connection = conn; 
page.StartBlankForm("Map1", "First action"); 
AttachmentField clip = page.Form.Field("attach") as AttachmentField; 

// uploadedFile is a HtmlInputFile control 
byte[] data = new byte[uploadedFile.PostedFile.InputStream.Length]; 
uploadedFile.PostedFile.InputStream.Read(data, 0, (int) uploadedFile.PostedFile.InputStream.Length); 

// get just the filename 
string fileName = uploadedFile.PostedFile.FileName; 
int indexOfSlash = fileName.LastIndexOf("\\"); 
clip.Value = fileName.Substring(indexOfSlash+1, fileName.Length-indexOfSlash-1); 

clip.Attachment = data; 

page.Submit(); 

Requirements

Namespace: FreeFlow.Client

Assembly: FreeFlow.Client (in FreeFlow.Client.dll)

See Also

AttachmentField Members | FreeFlow.Client Namespace