Class
FileManagerUploadSettings

Configures file upload functionality including server endpoints, file restrictions, and upload events.

Definition

Constructors

FileManagerUploadSettings()

Declaration

cs-api-definition
public FileManagerUploadSettings()

Properties

AllowedExtensions

Restrict selectable file types by extension (case-insensitive). Provide values with leading dot (e.g., .pdf, .png). Empty or null = allow all. Also validate again on the server for security.

Declaration

cs-api-definition
[Parameter]
public List<string> AllowedExtensions { get; set; }

Property Value

List<string>

MaxFileSize

Enforce a maximum file size in bytes. Files larger than this are rejected during OnSelect. Example: MaxFileSize=5242880 limits to 5 MB. Set together with AllowedExtensions for full client-side validation guidance.

Declaration

cs-api-definition
[Parameter]
public long? MaxFileSize { get; set; }

Property Value

long?

MinFileSize

Enforce a minimum file size in bytes. Files smaller than this are rejected during OnSelect. Example: MinFileSize=1024 rejects files under 1 KB.

Declaration

cs-api-definition
[Parameter]
public long? MinFileSize { get; set; }

Property Value

long?

OnCancel

Fires when the user cancels an in-progress upload. Use to clean up temporary server state if you manually created placeholders.

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadCancelEventArgs> OnCancel { get; set; }

Property Value

EventCallback<UploadCancelEventArgs>

OnError

Fires when an upload or remove operation fails (network / server / validation). Inspect error details and show notifications. Related to OnSuccess for the happy path.

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadErrorEventArgs> OnError { get; set; }

Property Value

EventCallback<UploadErrorEventArgs>

OnProgress

Fires periodically during file transmission. Use to display custom progress indicators (the built-in progress bar already reflects this).

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadProgressEventArgs> OnProgress { get; set; }

Property Value

EventCallback<UploadProgressEventArgs>

OnRemove

Fires before a file removal request is sent. Validate permissions or block deletion by cancelling. Related to OnError for server failures while removing.

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadEventArgs> OnRemove { get; set; }

Property Value

EventCallback<UploadEventArgs>

OnSelect

Fires after files are selected (before upload starts). Validate extension, size or rename files. Combine with AllowedExtensions, MinFileSize and MaxFileSize for consistent UX.

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadSelectEventArgs> OnSelect { get; set; }

Property Value

EventCallback<UploadSelectEventArgs>

OnSuccess

Fires after a file successfully uploads. Access server response or update FileManager data source. Typical use: refresh FileManager listing (await FileManagerRef.ProcessDataAsync()) when new files appear.

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadSuccessEventArgs> OnSuccess { get; set; }

Property Value

EventCallback<UploadSuccessEventArgs>

OnUpload

Fires just before an upload starts (per file batch). Use to add custom headers, additional form fields or to cancel. Set e.IsCancelled = true (if available) or throw to prevent the upload. Related to OnSelect (file chosen) and OnSuccess (completed).

Declaration

cs-api-definition
[Parameter]
public EventCallback<UploadEventArgs> OnUpload { get; set; }

Property Value

EventCallback<UploadEventArgs>

RemoveField

Set the form key that lists file names for deletion requests to RemoveUrl. Default is "files". Usually matches SaveField. Example: RemoveField="attachments".

Declaration

cs-api-definition
[Parameter]
public string RemoveField { get; set; }

Property Value

string

RemoveUrl

Set the endpoint that handles deletion of previously uploaded files (HTTP POST/DELETE depending on implementation). The request payload contains file names under RemoveField (default: "files"). Example: RemoveUrl="/api/files/delete".

Declaration

cs-api-definition
[Parameter]
public string RemoveUrl { get; set; }

Property Value

string

SaveField

Set the form field name that carries uploaded file(s) to SaveUrl. Default is "files". Change only if your backend expects a different key. Example: SaveField="attachments".

Declaration

cs-api-definition
[Parameter]
public string SaveField { get; set; }

Property Value

string

SaveUrl

Set the endpoint that receives uploaded file content (HTTP POST). Required for server (async) upload. You receive one or more files under the form field specified by SaveField (default: "files"). Example: SaddveUrl="/api/files/upload".

Declaration

cs-api-definition
[Parameter]
public string SaveUrl { get; set; }

Property Value

string

WithCredentials

Send cross-site credentials (cookies, authorization headers) with upload/remove requests when true. Enable only if your API requires authentication and CORS allows credentials. Mirrors the browser withCredentials flag.

Declaration

cs-api-definition
[Parameter]
public bool WithCredentials { get; set; }

Property Value

bool

Methods

Dispose()

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

OnInitialized()

Declaration

cs-api-definition
protected override void OnInitialized()

Overrides ComponentBase.OnInitialized()