Requirements
- WorkflowGen v6.1.4 and later
- WorkflowFileUpload v3.0.5 and later
Procedure
- In the form designer, add an attachment tool to your form with the Enable advanced mode option checked, or add a new WorkflowFileUpload control to your custom web form in Visual Studio.
- Rename the control ID (e.g. REQUEST_FILE1).
- Add a parameter to the action that returns the file attachment from REQUEST_FILE1 to a process data (e.g. REQUEST_FILE1 : OUT : DATA_FILE1).
- In an asp:Button control’s Click event or a form’s Page_Load event, add a call to the WorkflowFileUpload’s AttachFile() method, which adds a file to the control, or a call to the RemoveFile() method, which removes a file from the control. The file must be locally accessible to the web server hosting the web form.
Example for attaching a file
protected void BUTTON_ATTACH_FILE_Click(object sender, EventArgs e) {
REQUEST_FILE1.AttachFile("\\ServerComputerName\ShareName\file.txt");
}
Example for removing a file
protected void BUTTON_REMOVE_FILE_Click(object sender, EventArgs e) {
REQUEST_FILE1.RemoveFile();
}
How to add a file upload control/ link button in gridview?
My use case is to upload a file and download using link button.