Class UploaderAsyncSettings
Represents the asynchronous settings configuration for the SfUploader component, enabling chunk upload, retry mechanisms, and server endpoint configurations.
Inherited Members
Namespace: Syncfusion.Blazor.Inputs
Assembly: Syncfusion.Blazor.dll
Syntax
public class UploaderAsyncSettings : SfBaseComponent
Remarks
The UploaderAsyncSettings class provides comprehensive configuration options for handling asynchronous file upload operations. It supports chunk-based uploading for large files, automatic retry mechanisms for failed uploads, and configurable server endpoints for save and remove operations. This class is essential for implementing robust file upload functionality with enhanced reliability and performance optimization.
Examples
The following example demonstrates how to configure asynchronous settings for the Uploader component:
<SfUploader>
<UploaderAsyncSettings
SaveUrl="/api/upload"
RemoveUrl="/api/remove"
ChunkSize="1048576"
RetryCount="3"
RetryAfterDelay="1000">
</UploaderAsyncSettings>
</SfUploader>
Constructors
UploaderAsyncSettings()
Declaration
public UploaderAsyncSettings()
Properties
ChunkSize
Gets or sets the chunk size in bytes for splitting large files into smaller chunks during upload.
Declaration
public double ChunkSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double value representing the chunk size in bytes. The default value is 0, which disables chunk upload. |
Remarks
When the ChunkSize property is set to a value greater than 0, the SfUploader automatically enables chunk upload functionality. Large files are divided into smaller chunks of the specified size and uploaded sequentially to the server. This approach improves upload reliability for large files and provides better progress tracking. The chunk size must be specified in bytes and should be chosen based on network conditions and server capabilities.
Examples
<UploaderAsyncSettings ChunkSize="1048576"> <!-- 1 MB chunks -->
</UploaderAsyncSettings>
RemoveUrl
Gets or sets the server endpoint URL for handling file removal operations.
Declaration
public string RemoveUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the server URL that handles file removal requests. The default value is System.String.Empty. |
Remarks
The RemoveUrl property specifies the server endpoint that will receive and process file removal requests. The server endpoint must accept POST requests and should define a "RemoveFileNames" attribute to receive the file information that needs to be removed. This property is optional; if not specified, the remove functionality will be disabled. The server implementation should handle the removal of files from the storage location and return appropriate responses.
Examples
<UploaderAsyncSettings RemoveUrl="/api/files/remove">
</UploaderAsyncSettings>
RetryAfterDelay
Gets or sets the delay time in milliseconds before automatic retry attempts for failed uploads.
Declaration
public double RetryAfterDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double value representing the delay in milliseconds before retry attempts. The default value is 500 milliseconds. |
Remarks
The RetryAfterDelay property controls the waiting period between failed upload attempts and automatic retries. This delay helps prevent overwhelming the server with immediate retry requests and allows for temporary network issues to resolve. The delay is applied before each retry attempt, providing a progressive approach to handling upload failures. A reasonable delay value improves the success rate of retry operations while maintaining good user experience.
Examples
<UploaderAsyncSettings RetryAfterDelay="1000"> <!-- 1 second delay -->
</UploaderAsyncSettings>
RetryCount
Gets or sets the maximum number of retry attempts for failed file uploads.
Declaration
public int RetryCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An System.Int32 value representing the maximum number of retry attempts. The default value is 3. |
Remarks
The RetryCount property defines the maximum number of automatic retry attempts the SfUploader will perform when a file upload fails. This property is essential to prevent infinite retry loops and control resource usage. After the specified number of retry attempts is exhausted, the upload will be marked as failed. Setting an appropriate retry count helps balance between upload reliability and system performance. The retry mechanism works in conjunction with RetryAfterDelay to provide controlled and intelligent retry behavior.
Examples
<UploaderAsyncSettings RetryCount="5"> <!-- Maximum 5 retry attempts -->
</UploaderAsyncSettings>
SaveUrl
Gets or sets the server endpoint URL for handling file upload and save operations.
Declaration
public string SaveUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the server URL that handles file upload requests. The default value is System.String.Empty. |
Remarks
The SaveUrl property specifies the server endpoint that will receive uploaded files and handle the save operations. The server endpoint must accept POST requests and should define the request parameter with the same input name used to render the component. This URL is essential for asynchronous file upload functionality and must be properly configured to handle multipart form data. The server implementation should process the uploaded files, save them to the desired location, and return appropriate responses indicating success or failure.
Examples
<UploaderAsyncSettings SaveUrl="/api/files/upload">
</UploaderAsyncSettings>