Setting the file limit of the Files (Attachment) object
The file upload size limit, which is 4 Mb by default, can be revised to be application-wide, or it can be limited by controlling the object in the process with code.
##1- Setting the file size limit in the eBA app
On IIS, where the eBA application is installed, the process must be provided for application definitions named eba.net and eba.net.dm.
In addition, the definition should be made in the 'eBAConfigurationEditor.exe' under the common folder in the directory where the eBA application is installed.
1.1- Configuring IIS settings
There are two different parts for configuring eba.net and eba.net.dm application definitions. The relevant definitions in the mentioned 'system.webServer/security/requestFiltering' and 'system.web/httpRuntime' breakdown must be performed for both applications.
When the application definition is clicked, double-click 'Configuration Editor' in the 'Features View' tab and select "system.web/httpRuntime" among the selections at the top of the page. For the maxRequestLength value, the value in kilobytes (kb) must be entered.
When the application definition is clicked, double-click the 'Configuration Editor' in the 'Features View' tab and select "system.webServer/security/requestFiltering" among the selections at the top of the page. For the maxAllowedContentLength value under the requestLimits breakdown, the value in bytes (b) must be entered.
1.2- Configuring the eBA Config setting
If there is no MaximumAttachmentSize value under the 'config >
web' breakdown in the Advanced tab in the 'eBAConfigurationEditor.exe' application under the common folder in the directory where the eBA application is installed, it is added by entering the bottom line and its value must be entered in megabytes (mb).
After the change, the windows service of the eBA application should be restarted.
2- Control of the file size limit specific to the object in the project
Lower than the file size limit allowed in the eBA application, the file size can be controlled in the desired files (attachment) object in the desired processes.
In the example project below, there is a function that calculates the total file size based on category. As in the example, files can be used in the onAfterAttach event of the attachment object, or the file size information can be hosted in a textBox and a warning can be given in the validation of the form.
using eBAPI.Connection;
using eBAPI.DocumentManagement;
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.");