Server side events
1 Oct 20152 minutes to read
Event Names | Description | Parameters |
---|---|---|
OnComplete | Event triggered when the file upload is completed |
(Object Sender, UploadBoxCompleteEventArgs e)Values passed in argument are as below, Size - to get the file size Name - returns uploaded file name Extension - to get the uploaded file extension EventType - returns the event name FileStatus - to get the dictionary value of Size, Name, Extension and RawFile |
OnErrorFile | Event triggered when the file upload is returned with an error without uploading it |
(Object Sender, UploadBoxErrorFileEventArgs e)Values passed in argument are as below, Size - to get the file size Name - returns uploaded file name Extension - to get the uploaded file extension EventType - returns the event name Arguments - to get the dictionary value of action, errors and file details Action – returns the current upload action |
OnRemoveFile | Event triggered when a uploaded file is removed |
(Object Sender, UploadBoxErrorFileEventArgs e)Values passed in argument are as below,
Size - to get the file size Name - returns uploaded file name Extension - to get the uploaded file extension EventType - returns the event name FileStatus - to get the dictionary value of Size, Name, Extension and RawFile |
The following steps explain the configuration of the Server side events in UploadBox.
In the ASPX page, add the UploadBox element.
<ej:UploadBox ID="Uploadbox" runat="server" SaveUrl="SaveFiles.ashx" RemoveUrl="RemoveFiles.ashx" OnComplete="Uploadbox_Complete" OnErrorFile="Uploadbox_ErrorFile" OnRemoveFile="Uploadbox_RemoveFile"></ej:UploadBox>
NOTE
The SaveUrl and RemoveUrl are the same as above (see Save File Action and Remove File Action section).
Define the corresponding server side handlers in code behind
protected void Uploadbox_Complete(object sender, Syncfusion.JavaScript.Web.UploadBoxCompleteEventArgs e)
{
//e.Size - Gets the file size
//e.Name - Returns uploaded file name
//e.Extension - Gets the uploaded file extension
//e.EventType - Returns the event name
//e.FileStatus - Gets the dictionary value of Size, Name, Extension and RawFile
}
protected void Uploadbox_ErrorFile(object sender, Syncfusion.JavaScript.Web.UploadBoxErrorFileEventArgs e)
{
//e.Size - Gets the file size
//e.Name - Returns uploaded file name
//e.Extension - Gets the uploaded file extension
//e.EventType - Returns the event name
//e.Arguments - Gets the dictionary value of action, errors and file details
//e.Action – Returns the current upload action
}
protected void Uploadbox_RemoveFile(object sender, Syncfusion.JavaScript.Web.UploadBoxRemoveFileEventArgs e)
{
//e.Size - Gets the file size
//e.Name - Returns uploaded file name
//e.Extension - Gets the uploaded file extension
//e.EventType - Returns the event name
//e.FileStatus - Gets the dictionary value of Size, Name, Extension and RawFile
}