RadAsyncUpload
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[EmbeddedSkin("Upload", typeof(RadAsyncUpload))]
[EmbeddedSkin("Upload", "Default", typeof(RadAsyncUpload))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadAsyncUpload))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[TelerikToolboxCategory("Upload")]
[ToolboxBitmap(typeof(RadAsyncUpload), "Toolbox.Icons.AsyncUpload.png")]
[RequiredScript(typeof(Core))]
[RequiredScript(typeof(jQueryPlugins))]
[RequiredScript(typeof(MaterialRipple))]
[ClientScriptResource("Telerik.Web.UI.RadAsyncUpload", "Telerik.Web.UI.AsyncUpload.RadAsyncUploadScripts.js")]
public class RadAsyncUpload : RadWebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl
Inheritance: objectControlWebControlRadWebControlRadAsyncUpload
Implements:
Inherited Members
Constructors
public RadAsyncUpload()
Properties
Gets or sets the allowed file extensions for uploading.
[TypeConverter(typeof(ListConverter))]
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
public string[] AllowedFileExtensions { get; set; }
The default value is empty string array. In order to check for multiple file extensions you should set an array of strings containing the allowed file extensions for uploading.
Set this property to empty array of strings in order to prevent the file extension checking.
Gets or sets the allowed MIME types for uploading.
[TypeConverter(typeof(ListConverter))]
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
public string[] AllowedMimeTypes { get; set; }
The default value is empty string array. In order to check for multiple mime types you should set an array of strings containing the allowed MIME types for uploading.
Set this property to string.Empty in order to prevent the mime type checking.
Gets the object that controls the Wai-Aria settings applied on the control's input element.
[PersistenceMode(PersistenceMode.InnerProperty)]
public WaiAriaSettings AriaSettings { get; }
Specifies whether a new File Input should be automatically added upon selecting a file to upload.
[ClientControlProperty]
[ClientPropertyName("_autoAddFileInputs")]
public bool AutoAddFileInputs { get; set; }
Gets or sets the size of the uploading chunks in bytes.
[PersistenceMode(PersistenceMode.Attribute)]
public int ChunkSize { get; set; }
The default value is 2097152(2MB).
When FileApi upload module is used the selected files are uploading on chunks and the property set theirs size.
Gets or sets the control objects visibility.
[Browsable(false)]
[Bindable(true)]
[Obsolete("This property is obsolete in RadAsyncUpload")]
public virtual ControlObjectsVisibility ControlObjectsVisibility { get; set; }
The control objects visibility.
The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()
protected override string CssClassFormatString { get; }
Overrides:
Gets or sets the selected culture. Localization strings will be loaded based on this value.
public CultureInfo Culture { get; set; }
The culture.
Gets or sets whether the upload will be in chunks (2MB each) or the file will be uploaded with one request.
[PersistenceMode(PersistenceMode.Attribute)]
[ClientControlProperty]
[ClientPropertyName("_disableChunkUpload")]
public bool DisableChunkUpload { get; set; }
The DisableChunkUpload.
Gets or sets the drop zones for upload.
[TypeConverter(typeof(ListConverter))]
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
public string[] DropZones { get; set; }
The values of the property should be a valid jQuery selectors. E.g. class name or Id of html element.
When set to true enables support for WAI-ARIA.
[ClientControlProperty]
[ClientPropertyName("enableAriaSupport")]
public bool EnableAriaSupport { get; set; }
Gets or sets whether to fire the FileUploaded event and process the files if the Page is valid, after the server side validation events.
[PersistenceMode(PersistenceMode.Attribute)]
public bool EnableCustomValidation { get; set; }
The control will fires its event and process the files if the Page is valid, after the server side validation events. If the Page is not valid the uploaded files are persisted between postbacks.
Gets or sets the value indicating whether the file input fields skinning will be enabled.
[Browsable(true)]
[Bindable(true)]
[ClientPropertyName("enableFileInputSkinning")]
[ClientControlProperty]
public bool EnableFileInputSkinning { get; set; }
true when the file input skinning is enabled; otherwise false.
The <input type=file> DHTML elements are not skinnable by default. If the EnableFileInputSkinning is true some browsers can have strange behavior.
Gets or sets a value indicating if RadAsyncUpload should check the Telerik.Web.UI.WebResource handler existence in the application configuration file.
public bool EnableHandlerDetection { get; set; }
The check is not performed when custom handler is used.
Specifies whether RadAsyncUpload displays an inline progress next to each file being uploaded.
[ClientControlProperty]
[ClientPropertyName("_enableInlineProgress")]
public bool EnableInlineProgress { get; set; }
The default value is false
The InlineProgress is turned on by default. If you have RadProgressArea on the page both the area and the inline progress are going to be shown. In order to suppress the InlineProgress, consider setting the property to false.
Specifies whether RadAsyncUpload performs check for write permissions upon load
public bool EnablePermissionsCheck { get; set; }
The default value is true
The permissions check is turned on by default. You should disable it if you plan to upload the files directly to the handler without using the temporary folder. If you still want to use temporary folder make sure that you have set the TemporyFilesFolder property to a folder that has write permissions for the
Gets the collection of FileFilter objects to be applied to the OpenFileDialog
[PersistenceMode(PersistenceMode.InnerProperty)]
public FileFilterCollection FileFilters { get; }
A FileFilterCollection containing FileFilter object that define the filters applied to the OpenFileDialog
protected FilterFormatter FilterFormatter { get; }
Gets or sets whether to render the file input.
[PersistenceMode(PersistenceMode.Attribute)]
[ClientControlProperty]
[ClientPropertyName("_hideFileInput")]
public bool HideFileInput { get; set; }
When HideFileInput is set to True, only the select button will be rendered.
Specifies the URL of the HTTPHandler from which the image will be served
Gets or sets the initial count of file input fields, which will appear in RadAsyncUpload.
[Browsable(true)]
[Bindable(true)]
[ClientPropertyName("initialFileInputsCount")]
[ClientControlProperty]
public int InitialFileInputsCount { get; set; }
The file inputs count which will be available at startup. The default value is 1.
Gets or sets the size of the file input field
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
[ClientPropertyName("inputSize")]
[ClientControlProperty]
public int InputSize { get; set; }
The default value is 23.
Used to customize the Navigation keyboard navigation functionality.
[PersistenceMode(PersistenceMode.InnerProperty)]
public KeyboardNavigationSettings KeyboardNavigationSettings { get; }
Gets the localization.
[PersistenceMode(PersistenceMode.InnerProperty)]
public AsyncUploadStrings Localization { get; }
The localization.
Gets or sets a value indicating where RadAsyncUpload will look for its .resx localization files.
public string LocalizationPath { get; set; }
The localization path.
Gets or sets whether the upload will start automatically after the files are selected.
[PersistenceMode(PersistenceMode.Attribute)]
[ClientControlProperty]
[ClientPropertyName("_manualUpload")]
public bool ManualUpload { get; set; }
The manual upload.
Gets or sets the maximum file input fields that can be added to the control.
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
[ClientPropertyName("maxFileCount")]
[ClientControlProperty]
public int MaxFileInputsCount { get; set; }
The default value is 0 (unlimited).
Using this property you can limit the maximum number of file inputs which can be added to a RadAsyncUpload instance. MaxFileInputs count is only applicable when MultipleFileSelection is set to Disabled
Gets or sets the maximum file size allowed for uploading in bytes.
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
[ClientControlProperty]
[ClientPropertyName("_maxFileSize")]
public int MaxFileSize { get; set; }
The default value is 0 (unlimited).
Set this property to 0 in order to prevent the file size checking.
Specifies whether RadAsyncUpload allows selecting multiple files in the File Selection dialog.
[ClientControlProperty]
[ClientPropertyName("_multipleFileSelection")]
public MultipleFileSelection MultipleFileSelection { get; set; }
The default value is Disabled
Setting the MultipleFileSelection property to Automatic means that RadAsyncUpload will check the client's browser capabilities and if there is support for multiple file selection he will enable it. If there is no such support, the selection type would be still single.
Gets or sets the name of the client-side function which will be executed after a new file input is added to a RadAsyncUpload instance. The event cannot be cancelled
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("added")]
public string OnClientAdded { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed before a new file input is added to a RadAsyncUpload instance. This event can be cancelled.
[Browsable(false)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("adding")]
protected string OnClientAdding { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed after a file has been dropped.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileDropped")]
public string OnClientFileDropped { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed after a file has been selected.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileSelected")]
public string OnClientFileSelected { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed after files have been selected. This event can be cancelled.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("filesSelected")]
public string OnClientFilesSelected { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed after all selected files have been uploaded
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("filesUploaded")]
public string OnClientFilesUploaded { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed when a file upload finishes successfully.k
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileUploaded")]
public string OnClientFileUploaded { get; set; }
The default value is string.Empty.
If specified, the OnClientFileUploaded client-side event is called when file is uploaded successfully.
- sender, the async upload client object;
- eventArgs with one property:
- get_fileName(), the name of the file that was uploaded.
This event cannot be cancelled.
Gets or sets the name of the client-side function which will be executed when a file upload ends unsuccessfully.
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileUploadFailed")]
public string OnClientFileUploadFailed { get; set; }
The default value is string.Empty.
If specified, the OnClientFileUploadFailed client-side event is called when a file fails to upload. One can set the set_handled property to false which will force the async upload to throw an exception the error message to the JavaScript console.
- sender, the async upload client object;
- eventArgs with three properties:
- get_message(), the error message containing the reason for the failed upload
- get_handled(), gets a value indicating whether the developer will handle the error
- set_handled(), sets a value indicating whether the developer will handle the error
This event cannot be cancelled.
Gets or sets the name of the client-side function which will be executed when a file upload starts.
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileUploading")]
public string OnClientFileUploading { get; set; }
The default value is string.Empty.
If specified, the OnClientFileUploading client-side event is called whenever a file upload commences.
- sender, the async upload client object;
- eventArgs with one property:
- get_fileName(), the name of the file being uploaded.
This event cannot be cancelled.
Gets or sets the name of the client-side function which will be executed after a file input has been deleted from a RadAsyncUpload instance.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileUploadRemoved")]
public string OnClientFileUploadRemoved { get; set; }
The default value is string.Empty.
Gets or sets the name of the client-side function which will be executed before a file input is deleted from a RadAsyncUpload instance. The event can be cancelled.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("fileUploadRemoving")]
public string OnClientFileUploadRemoving { get; set; }
The default value is string.Empty.
If you want to cancel the deleting of the file input return false in the javascript handler.
Gets or sets the client progress updating.
[Browsable(true)]
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("progressUpdating")]
public string OnClientProgressUpdating { get; set; }
The client progress updating.
Gets or sets the name of the client-side function which will be executed if the selected file has invalid extension
[Bindable(true)]
[ClientControlEvent]
[ClientPropertyName("validationFailed")]
public string OnClientValidationFailed { get; set; }
The default value is string.Empty.
If specified, the onClientValidationFailed client-side event is called when a file has invalid extension or its size exceeds the maximum allowed size
- sender, the async upload client object;
- eventArgs with two properties:
- get_fileName(), the name of the file that failed to upload.
- get_fileInputField(), the file input field DOM element.
This event cannot be cancelled.
Gets or sets whether the upload configuration to be persisted into ControlState(if the upload configuration is different than null).
[Browsable(true)]
public bool PersistConfiguration { get; set; }
The default value is false.
Comma separated values - controls' ids. If the property is set the client state is updated in case some of the enumerated controls, triggered a postback.
[TypeConverter(typeof(ListConverter))]
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
public string[] PostbackTriggers { get; set; }
The default value is string.Empty.
Gets or sets the URL of the progress handler that takes care of the progress monitoring.
[PersistenceMode(PersistenceMode.Attribute)]
[Bindable(true)]
public string ProgressHandlerUrl { get; set; }
The progress handler URL.
protected override bool SupportsRenderingMode { get; }
Overrides:
protected override HtmlTextWriterTag TagKey { get; }
Overrides:
Gets or sets the virtual path of the folder, where RadUpload will automatically save the valid files after the upload completes.
[Browsable(true)]
[Bindable(true)]
public string TargetFolder { get; set; }
A string containing the virtual path of the folder where RadUpload will automatically save the valid files after the upload completes. The default value is string.Empty.
When set to string.Empty, the files must be saved manually to the desired location.
Sets how long temporary files should be kept before automatically deleting them. The property accepts TimeSpan values. The default value is 4 hours. More information regarding the TimeSpan structure can be found here - http://www.dotnetperls.com/timespan RadAsyncUpload1.TemporaryFileExpiration = New TimeSpan(2, 0, 0, 0, 0);
public TimeSpan TemporaryFileExpiration { get; set; }
Note that when a postback occurs temporary files are either saved as permanent or removed. The expiration time is used only in cases when files are uploaded asynchronously, but a subsequent postback does not occur.
Path to a folder where RadAsyncUpload should save files temporarily until a postback occurs.
public string TemporaryFolder { get; set; }
The ASP.NET process needs to have Write permissions for the specified folder. Also note that in Medium Trust scenarios this should point to a subfolder of the Application Path. Defaults to App_Data\RadUploadTemp subfolder of the Application Path.
Sets upload configuration that has additional information. The generic object can be obtained using the CreateUploadConfiguration <T> method, where T is custom class that implements IAsyncUploadConfiguration. The custom class can contain any sort of custom data.
[Browsable(false)]
public IAsyncUploadConfiguration UploadConfiguration { get; set; }
Provides access to the valid files uploaded by the RadAsyncUpload instance.
[Browsable(false)]
public UploadedFileCollection UploadedFiles { get; }
UploadedFileCollection containing all valid files uploaded using a RadAsyncUpload control.
Specify where the uploaded files should be positioned, below or above the current file input.
[ClientControlProperty]
[ClientPropertyName("_uploadedFilesRendering")]
public UploadedFilesRendering UploadedFilesRendering { get; set; }
The default value is AboveFileInput
Setting the UploadedFilesRendering property to BelowFileInput means that RadAsyncUpload will render the uploaded files below the current file input. Otherwise the uploaded files will be rendered above the file input.
Gets or sets the upload request identifier.
[Browsable(false)]
[ClientControlProperty]
[ClientPropertyName("_pageGUID")]
public string UploadRequestIdentifier { get; set; }
The upload request identifier.
If the value is
IsNullOrEmpty, a NewGuid value is assigned.
Gets or sets whether to use application pool impersonation.
[PersistenceMode(PersistenceMode.Attribute)]
public bool UseApplicationPoolImpersonation { get; set; }
The usage of application pool impersonation.
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
protected virtual void CheckForHandlerRegistration()
Creates an object of type T (that implements IAsyncUploadConfiguration) and populates all properties specified in the interface from this RadAsyncUpload instance. The user is then free to populate any additional properties.
public T CreateDefaultUploadConfiguration<T>() where T : IAsyncUploadConfiguration, new()
T
An object of type T populated with all properties specified in IAsyncUploadConfiguration
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
protected virtual void EnsureDefaultTemporaryFolderExists()
protected override void LoadControlState(object savedState)
Overrides:
Executed when post data is loaded from the request
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Overrides:
protected virtual void PlayClientState(string clientStateValue)
Executed when post data changes should invoke a changed event
protected override void RaisePostDataChangedEvent()
Overrides:
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
Saves the client state data
protected virtual void TestTemporaryFolderPermissions()
Events
Occurs once for each uploaded file.
public event FileUploadedEventHandler FileUploaded