When using the igUpload
control be aware of the following limitations of the control or are exposed from browsers limitations:
igUpload
control doesn’t support keyboard navigation, except during tabbed navigation, then the control will gain focus on the page. When using the TAB key, you can navigate the control and its elements.The jQuery Upload control, including the Ignite UI for MVC Upload, don’t have server events. You can only point the handler and the folder where it uploads all the files, but you cannot handle and delete or move the files when the upload is finished. However you do have a workaround available in the context of ASP.NET™ MVC: in the Global.asax file you can attach manually to the server-side events to perform necessary logic to accompany the upload.
Note: This approach is not meant to be a prescription for a best practice, but a work around to the limitation. Using the global events will fire those events for each page in the application, therefore you must make sure the code only executes in the context of the pages that are doing an upload.
The following sample demonstrates how to attach a handler in the Global.asax file and delete the uploaded file:
In Global.asax:
using Infragistics.Web.Mvc.Models;
protected void Application_Start()
{
UploadProgressManager upm = UploadProgressManager.Instance;
upm.AddFinishingUploadEventHandler("serverID1", this.OnFileFinishing);
}
protected void OnFileFinishing(object sender, UploadFinishingEventArgs e)
{
string filePath = String.Format("{0}{1}", e.FolderPath, e.TemporaryFileName);
if (File.Exists(filePath))
{
try
{
File.Delete(filePath);
}
catch (Exception ex)
{
}
}
}
Note: For more information about the use classes and events you can follow the Using HTTP Handler and Module topic and go through the API help.
The igUpload
control depends on the following separate Ignite UI for jQuery™ widgets – igButton
igBrowseButton
, igProgressBar
and the ajaxQueue plugin. These widgets are included with the igUpload
control so you have them available by default.
Also, the widget uses strings defined from an external JavaScript file ig.ui.fileupload-en.js. Other language locales may be added by creating other similar files with the proper two letter language suffix.
View on GitHub