# Upload

Namespace: **Wisej.Web**

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

* [Control](https://docs.wisej.com/api/wisej.web/general/control)
  * [Upload](https://docs.wisej.com/api/wisej.web/content/upload)

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Upload()

Initializes a new instance of [Upload](https://docs.wisej.com/api/wisej.web/content/upload).

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CaptureMode

[CaptureMode](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.capturemode): 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) DefaultSize

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) HideValue

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/content/upload) control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/content/upload) control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Invalid

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) InvalidMessage

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Text

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Abort()

Aborts the current upload request, if in progress.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnError(e)

Fires the [Error](#error) event.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnProgress(e)

Fires the [Progress](#progress) event.

| Parameter | Type                                                                                                             | Description                                                                                                                                      |
| --------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **e**     | [UploadProgressEventArgs](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadprogresseventargs) | A [UploadProgressEventArgs](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadprogresseventargs) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnUploaded(e)

Fires the [Uploaded](#uploaded) event.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnUploading(e)

Fires the [Uploading](#uploading) event.

| Parameter | Type                                                                                                   | Description                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [UploadingEventArgs](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadingeventargs) | A [UploadingEventArgs](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadingeventargs) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) 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. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebEvent(e)

Processes the event from the client.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebRender(config)

Renders the client component.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) UploadFiles()

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

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Error

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Progress

[UploadProgressEventHandler](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadprogresseventhandler) Fired while the [Upload](https://docs.wisej.com/api/wisej.web/content/upload) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Uploaded

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Uploading

[UploadingEventHandler](https://docs.wisej.com/api/wisej.web/content/upload/wisej.web.uploadingeventhandler) Fired before the [Upload](https://docs.wisej.com/api/wisej.web/content/upload) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ValueChanged

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

## Implements

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