# Upload

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Control](/api/wisej.web/general/control.md)
  * [Upload](/api/wisej.web/content/upload.md)

Represent an upload widget. Allows users to selected one or more files and upload them to the server.

{% tabs %}
{% tab title="C#" %}

```csharp
public class Upload : Control, IWisejHandler, IValidation
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class Upload
    Inherits Control
    Implements IWisejHandler, IValidation
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) Upload()

Initializes a new instance of [Upload](/api/wisej.web/content/upload.md).

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) AllowedFileTypes

[String](https://docs.microsoft.com/dotnet/api/system.string): Specify the types of files that the server accepts (that can be submitted through a file upload). (Default: `""`)

The allowed files string follows the HTML 4.01 and HTML5 specifications. You can configure only one entry in the browser's file dialog. The syntax is "file\_extension|audio/*|video/*|image/\*|media\_type" where

* file\_extension A file extension starting with the dot, e.g: .gif, .jpg, .png, .doc.
* audio/\* All sound files are accepted
* video/\* All video files are accepted
* image/\* All image files are accepted
* media\_type A valid media type, with no parameters. Look at [IANA Media Types](http://www.iana.org/assignments/media-types/media-types.xhtml) for a complete list of standard media types.

### ![](/files/hsR4ok3152WyAf8J2C1u) AllowFolders

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the upload control allows the selection of a directory for upload. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) AllowMultipleFiles

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the upload control allows the selection of multiple files. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ButtonPosition

[ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment): Returns or sets the position of the upload button relative to the value field.. (Default: `MiddleRight`)

### ![](/files/hsR4ok3152WyAf8J2C1u) CaptureMode

[CaptureMode](/api/wisej.web/content/upload/wisej.web.capturemode.md): Returns or sets a value that specifies which camera to use for capture of image or video data, if the [AllowedFileTypes](#allowedfiletypes) property indicates that the input should be of one of those types. (Default: `Default`)

### ![](/files/lzopMboA31bVq8UIcbT3) DefaultSize

[Size](https://docs.microsoft.com/dotnet/api/system.drawing.size):

### ![](/files/hsR4ok3152WyAf8J2C1u) HideValue

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the value field is visible. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Image

[Image](https://docs.microsoft.com/dotnet/api/system.drawing.image): Returns or sets the icon that is displayed in the upload button in the [Upload](/api/wisej.web/content/upload.md) control.

### ![](/files/hsR4ok3152WyAf8J2C1u) ImageSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the theme name or URL for the icon to display in the upload button in the [Upload](/api/wisej.web/content/upload.md) control.

### ![](/files/hsR4ok3152WyAf8J2C1u) Invalid

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value that indicates that the control is invalid.

### ![](/files/hsR4ok3152WyAf8J2C1u) InvalidMessage

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the invalid message that is shown in the invalid tooltip. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) MaxFileSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the maximum file size in bytes. (Default: `0`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The value specified is less than 0.

### ![](/files/hsR4ok3152WyAf8J2C1u) ShowLoader

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the upload control shows a the ajax-loader image when uploading the file(s). (Default: `True`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Text

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text associated with this control. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) TextAlign

[ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment): Returns or sets the alignment of the text on the button control. (Default: `MiddleCenter`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Value

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text to display in the text fields part of the control. (Default: `""`)

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Abort()

Aborts the current upload request, if in progress.

### ![](/files/lzopMboA31bVq8UIcbT3) OnError(e)

Fires the [Error](#error) event.

| Parameter | Type                                                                                    | Description                                                                                                             |
| --------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **e**     | [UploadErrorEventArgs](/api/wisej.web/content/upload/wisej.web.uploaderroreventargs.md) | A [UploadErrorEventArgs](/api/wisej.web/content/upload/wisej.web.uploaderroreventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnProgress(e)

Fires the [Progress](#progress) event.

| Parameter | Type                                                                                          | Description                                                                                                                   |
| --------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [UploadProgressEventArgs](/api/wisej.web/content/upload/wisej.web.uploadprogresseventargs.md) | A [UploadProgressEventArgs](/api/wisej.web/content/upload/wisej.web.uploadprogresseventargs.md) that contains the event data. |

This event fires only if there is an handler attached to it. A simple overload of the On\[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

### ![](/files/lzopMboA31bVq8UIcbT3) OnUploaded(e)

Fires the [Uploaded](#uploaded) event.

| Parameter | Type                                                                              | Description                                                                                                       |
| --------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **e**     | [UploadedEventArgs](/api/wisej.web/content/upload/wisej.web.uploadedeventargs.md) | A [UploadedEventArgs](/api/wisej.web/content/upload/wisej.web.uploadedeventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnUploading(e)

Fires the [Uploading](#uploading) event.

| Parameter | Type                                                                                | Description                                                                                                         |
| --------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| **e**     | [UploadingEventArgs](/api/wisej.web/content/upload/wisej.web.uploadingeventargs.md) | A [UploadingEventArgs](/api/wisej.web/content/upload/wisej.web.uploadingeventargs.md) that contains the event data. |

This event fires only if there is an handler attached to it. A simple overload of the On\[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

### ![](/files/lzopMboA31bVq8UIcbT3) OnValueChanged(e)

Fires the [ValueChanged](#valuechanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                        | Description      |
| --------- | ----------------------------------------------------------- | ---------------- |
| **e**     | [WisejEventArgs](/api/wisej.core/general/wisejeventargs.md) | Event arguments. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](/files/hsR4ok3152WyAf8J2C1u) UploadFiles()

Opens the file selection dialog and uploads the files selected by the user.

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) Error

[UploadErrorEventHandler](/api/wisej.web/content/upload/wisej.web.uploaderroreventhandler.md) Fired when the [Upload](/api/wisej.web/content/upload.md) control generates an upload error.

### ![](/files/hsR4ok3152WyAf8J2C1u) Progress

[UploadProgressEventHandler](/api/wisej.web/content/upload/wisej.web.uploadprogresseventhandler.md) Fired while the [Upload](/api/wisej.web/content/upload.md) control receives the data being uploaded.

This event fires only if there is an handler attached to it. A simple overload of the On\[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.

### ![](/files/hsR4ok3152WyAf8J2C1u) Uploaded

[UploadedEventHandler](/api/wisej.web/content/upload/wisej.web.uploadedeventhandler.md) Fired when files are uploaded to the [Upload](/api/wisej.web/content/upload.md) control.

### ![](/files/hsR4ok3152WyAf8J2C1u) Uploading

[UploadingEventHandler](/api/wisej.web/content/upload/wisej.web.uploadingeventhandler.md) Fired before the [Upload](/api/wisej.web/content/upload.md) control received the files being uploaded.

This event fires only if there is an handler attached to it. A simple overload of the On\[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.\
You can abort the uploading process by setting e.Cancel = true in the event handler.

### ![](/files/hsR4ok3152WyAf8J2C1u) ValueChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the user has selected the files to upload.

## Implements

| Name                                                                              | Description                                                                                                           |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.       |
| [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                         |
| [IDropTarget](/api/wisej.web/interfaces/wisej.web.idroptarget.md)                 | Controls that support drag & drop operations implement this interface.                                                |
| [IValidation](/api/wisej.web/interfaces/wisej.web.ivalidation.md)                 | Provides access to the validation events and properties property for controls that support validation.                |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                        |
| [IWisejControl](/api/wisej.core/interfaces/wisej.core.iwisejcontrol.md)           | All wisej controls derived from the [Control](/api/wisej.web/general/control.md) class must implement this interface. |
| [IWisejHandler](/api/wisej.core/interfaces/wisej.core.iwisejhandler.md)           | Represents a Wisej component that is capable of handling postback requests from the client.                           |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/content/upload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
