# How can I delete a file attachment instead of adding/updating it using the standard .NET FileUpload control?

**URL:** <https://discuss.workflowgen.com/t/how-can-i-delete-a-file-attachment-instead-of-adding-updating-it-using-the-standard-net-fileupload-control/199>\
**Category:** Visual Studio Web Forms\
**Created:** [August 17, 2010, 12:47am UTC](https://discuss.workflowgen.com/t/how-can-i-delete-a-file-attachment-instead-of-adding-updating-it-using-the-standard-net-fileupload-control/199 "2010-08-17T00:47: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:** [August 17, 2010, 12:47am UTC](https://discuss.workflowgen.com/t/how-can-i-delete-a-file-attachment-instead-of-adding-updating-it-using-the-standard-net-fileupload-control/199/1 "2010-08-17T00:47:00Z")

</div>

### Issue

How can I delete a file attachment instead of adding/updating it using the standard .NET `FileUpload` control?

### Background

To do this, you need to set the `FileUpload` control as IN/OUT parameter in the WorkflowGen action so that the uploaded file can be imported and exported between the web form and WorkflowGen process data.

When using the .NET `FileUpload` Control, a user can only browse and upload a file to WorkflowGen upon submission. This allows the user to update the file, but not to delete an existing file. If you do not upload a new file, WorkflowGen just keeps the existing file without updating the associated process data.

### Solution

To allow a user to add or remove a file using the standard .NET `FileUpload` control:

1. Add your own trigger to mark your `FileUpload` as `deleted`.

2. Clear your `FileUpload` in `FormData` after the `SubmitToWorkflow()` call at submission of your web form.

### Example

1. Create a `FileUpload` control with the ID `FileUpload1`:

2. Add a button to delete any existing file in `FileUpload1` inherited from the previous action:

3. In your code-behind, clear `FileUpload1` after the cal lto `SubmitToWorkflow()`:

Another approach is to use the `WorkflowGenFileUpload` control, which has a built-in delete function. Unfortunately, there is no attribute to only disable the `modify` option, but you can hide the delete option by clearing the `UpdateText`.

For example, if you have a `WorkflowGenFileUpload` with the ID `WFGFileUpload1`, you would add the following to your code-behind:

```auto
WFGFileUpload1.UpdateText = "";

```

Once a file is uploaded, the update link will not appear. Here’s the before and after:

**`xxxxxx.txt (4 Bytes) [| Delete]`** instead of **`xxxxxx.txt (4 Bytes) [Update | Delete]`**
