Skip to main content

Attachment Object - File Size Limitation Sample Code

Check the file size of the Files object


using eBAPI.Connection;

using eBAPI.DocumentManagement;

Must be added

In the OnafterAttach event of the object, the form e.g. The txtFileSize text box is written in MB.

public void Dosyalar1_OnAfterAttach(object sender, eBAAttachmentFileEventArgs e)

{

txtFileSize.Text = (fileSize()/(1024 * 1024)). ToString();

}

Related Method

public long fileSize()

{

eBAConnection eBACon = CreateServerConnection();

eBACon.Open();

Try

{

FileSystem fs = eBACon.FileSystem;

DMFile fileExcel = fs. GetFile("workflow/Project1/Form/" + id.ToString() + ".wfd");

DMCategoryContentCollection SourceAttachments = fileExcel.GetAttachments("default");

DMFileContent fl = SourceAttachments[0];

return fl. You;

}

finally

{

eBACon.Close();

}

}

On the validation code side of the form

if(txtFileSize ```>``` 10)

summary. AddMessage("File Size Cannot Be Greater Than 10MB.");