# How can I add a file to a process data without using a FileUpload control within an EFORMASPX form?

**URL:** <https://discuss.workflowgen.com/t/how-can-i-add-a-file-to-a-process-data-without-using-a-fileupload-control-within-an-eformaspx-form/190>\
**Category:** Visual Studio Web Forms\
**Created:** [October 8, 2008, 4:00am UTC](https://discuss.workflowgen.com/t/how-can-i-add-a-file-to-a-process-data-without-using-a-fileupload-control-within-an-eformaspx-form/190 "2008-10-08T04:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [October 8, 2008, 4:00am UTC](https://discuss.workflowgen.com/t/how-can-i-add-a-file-to-a-process-data-without-using-a-fileupload-control-within-an-eformaspx-form/190/1 "2008-10-08T04:00:00Z")

</div>

You can add a file to a process data without using any `FileUpload` controls within an EFORMASPX form.

WorkflowGen.My will look for a file uploaded by the `FileUpload` control at submission. If you want to dynamically add a file to a WorkflowGen process data without prompting the user to upload a file, you need to make sure that WorkflowGen.My is still prepared to receive a file as an OUT parameter even if there is no `FileUpload` control in the form.

### Solution

A standard file upload in WorkflowGen requires two pieces of information: a physical file to be uploaded to the action’s temporary storage path, and a parameter name registered as a valid data field in the form data file.

To do this without the help of a `FileUpload` control, do the following:

1. Prepare the source file by copying it to the WorkflowGen action temporary storage path.

2. Create an invisible .NET Label control on the form as a file placeholder for WorkflowGen’s form data.

3. Set the label’s text as the file path of the uploaded file.

### Example

```auto
//----- a label control with ID = "UPLOAD1" is added on aspx page

String SourceFolder = "C:\\Inetpub\\wwwroot\\wfgen\\WfApps\\MyProject";
String TargetFolder = "upload\\" + UPLOAD1.ID;
String FileName = "test.txt";

// --- prepare folder for temporary storage of the upload file
// --- StoragePath is a predefined string variable inherited from WorkflowGen
// --- containing the storage path for files of the current form action

DirectoryInfo di = new DirectoryInfo(StoragePath + "\\" + TargetFolder);
if (!di.Exists)
{ di.Create(); }

FileInfo fi = new FileInfo(SourceFolder + "\\" + FileName);
fi.CopyTo(StoragePath + "\\" + TargetFolder + "\\" + FileName);

UPLOAD1.Text = TargetFolder + "\\" + FileName;

```
