Uploader
Namespace: Wisej.Web.Ext.Syncfusion2
Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)
The uploader component allows to upload images, documents, and other files from local to server.
- C#
- VB.NET
public class Uploader : ej2Base
Public Class Uploader
Inherits ej2Base
The files are uploaded to the URL specified in the asyncSettings.saveUrl option, and removed using the URL specified in asyncSettings.removeUrl: the endpoints that receive the files must be provided by the application.
Constructors
Uploader()
Constructs a new instance of the Uploader class.
Example:
The following example creates an uploader and specifies the upload endpoints of the application through the Options object.
var uploader = new Uploader();
uploader.Options.asyncSettings = new
{
saveUrl = "/api/Upload/Save",
removeUrl = "/api/Upload/Remove"
};
uploader.Dock = DockStyle.Top;
this.Controls.Add(uploader);
Uploader(options)
Constructs a new instance of the Uploader class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates an uploader that accepts only PDF and Word files up to 5 MB, uploads them when the user clicks the upload button, and notifies the server of each file that has been uploaded.
var uploader = new Uploader(new
{
autoUpload = false,
allowedExtensions = ".pdf,.docx",
maxFileSize = 5 * 1024 * 1024,
asyncSettings = new { saveUrl = "/api/Upload/Save" }
});
uploader.Instance.onSuccess += new WidgetEventHandler((s, e) =>
{
if (e.Data.operation == "upload")
AlertBox.Show($"Uploaded {e.Data.file.name}");
});
uploader.Dock = DockStyle.Top;
this.Controls.Add(uploader);