formaui-net.Framework.Files
1.0.0-preview.27
Prefix Reserved
dotnet add package formaui-net.Framework.Files --version 1.0.0-preview.27
NuGet\Install-Package formaui-net.Framework.Files -Version 1.0.0-preview.27
<PackageReference Include="formaui-net.Framework.Files" Version="1.0.0-preview.27" />
<PackageVersion Include="formaui-net.Framework.Files" Version="1.0.0-preview.27" />
<PackageReference Include="formaui-net.Framework.Files" />
paket add formaui-net.Framework.Files --version 1.0.0-preview.27
#r "nuget: formaui-net.Framework.Files, 1.0.0-preview.27"
#:package formaui-net.Framework.Files@1.0.0-preview.27
#addin nuget:?package=formaui-net.Framework.Files&version=1.0.0-preview.27&prerelease
#tool nuget:?package=formaui-net.Framework.Files&version=1.0.0-preview.27&prerelease
Forma.Framework.Files
The types Forma.Blazor's file components report and track: a file a picker declined and why, a
file an uploader could not store and the error that stopped it, a file a store refused and why,
and the progress of each file in an upload. A host names them in the handlers it gives FormaFilePicker, FormaImagePicker and
FormaFileUploader.
The package comes with formaui-net.Blazor, and its types are in the
Forma.Framework.Files namespace. The store an uploader writes to and the resource each file
becomes are the contracts of
Forma.Framework.Resources.
What the components report
| Type | What it is |
|---|---|
RejectedFile |
The Name of a file a picker declined and the Reason it declined it. |
FileRejectionReason |
DisallowedType, a type outside the picker's Accept; TooLarge, over its MaxFileSize; TooManyFiles, beyond its MaxFiles. |
UploadFailure |
The Name of a file whose upload failed and the Error that stopped it, thrown by the store while saving it, or while removing it again in a rollback. |
UploadRefusal |
The Name of a file the store refused, its FileRefusal, and the localized Message the uploader shows beneath it. |
A picker raises OnFilesRejected with its rejections and OnFilesSelected with the files it
accepted. FormaFileUploader raises OnRefused once for each refusal, OnFailed once for each
failure and OnCompleted with the ResourceInfo every stored file became.
FormaFileUploader reads a file up to FileUploaderOptions.MaxFileSize, 10 MiB unless a host sets
another. A file the browser says is larger is refused as TooLarge, with the cap as its Limit,
before any of it is read, and a file that runs past the cap fails, whatever size the browser gave
it. A host storing larger files raises the cap:
<FormaFileUploader Files="_files" Options="@(new FileUploaderOptions { MaxFileSize = 100 * 1024 * 1024 })" />
@using Forma.Blazor.Components.Files
@using Forma.Framework.Files
@using Forma.Framework.Resources
@using Microsoft.AspNetCore.Components.Forms
<FormaFilePicker Options="_pickerOptions"
OnFilesSelected="HandleSelected"
OnFilesRejected="HandleRejected" />
<FormaFileUploader Files="_files"
OnCompleted="HandleCompleted"
OnRefused="HandleRefused"
OnFailed="HandleFailed" />
<ul role="status">
@foreach (var note in _notes)
{
<li>@note</li>
}
</ul>
@code {
private readonly FilePickerOptions _pickerOptions = new()
{
Accept = ".pdf",
MaxFileSize = 10 * 1024 * 1024,
MaxFiles = 5,
};
private readonly List<string> _notes = [];
private IReadOnlyList<IBrowserFile>? _files;
private void HandleSelected(IReadOnlyList<IBrowserFile> files)
{
_notes.Clear();
_files = files;
}
private void HandleRejected(IReadOnlyList<RejectedFile> rejections)
{
foreach (var rejection in rejections)
{
_notes.Add(rejection.Reason switch
{
FileRejectionReason.DisallowedType => $"{rejection.Name} is not a PDF.",
FileRejectionReason.TooLarge => $"{rejection.Name} is over 10 MB.",
_ => $"{rejection.Name} was left out; five at a time.",
});
}
}
private void HandleCompleted(IReadOnlyList<ResourceInfo> resources)
{
foreach (var resource in resources)
{
_notes.Add($"Stored at {resource.Source}.");
}
}
private void HandleRefused(UploadRefusal refusal)
=> _notes.Add(refusal.Message);
private void HandleFailed(UploadFailure failure)
=> _notes.Add($"{failure.Name} could not be stored.");
}
Upload progress
FormaFileUploader tracks each run in an UploadBatch, the files of one upload in the order they
upload, and draws a row for each UploadFile in it.
| Member | What it is |
|---|---|
UploadBatch.Files, Count, the indexer |
The files in the run. |
UploadBatch.HasPending, StartedCount, CompletedCount |
Whether any file still waits; how many have started; how many were stored. |
UploadBatch.TotalBytes, BytesTransferred |
The bytes in the run and the bytes stored so far. |
UploadBatch.Elapsed, BytesPerSecond, EstimatedTimeRemaining |
The run's duration so far, its rate, and the time the rest needs at that rate, or null while unknown. |
UploadBatch.Add(name, size), Clear() |
Adds a waiting file; empties the run and resets its clock. |
UploadBatch.BeginUpload(), EndUpload() |
Starts and stops the run's clock. |
UploadBatch.SetFileState(index, state, percent) |
Moves one file to a state; entering Uploading starts its clock and a later state stops it. |
UploadBatch.RefuseFile(index, refusal) |
Moves one file to Refused, with the store's refusal of it. |
UploadBatch.UpdateFileProgress(index, percent, transferred) |
Records how far one file's transfer has come. |
UploadBatch.TransitionPendingFiles(startIndex, state) |
Moves every waiting file from a position on to a state. |
UploadFile |
One file's Name, TotalBytes, State, ProgressPercentage, BytesTransferred, Elapsed, BytesPerSecond, EstimatedTimeRemaining and the store's Refusal of it. |
UploadState |
What it means |
|---|---|
Pending |
Waiting its turn. |
Uploading |
Moving to the store. |
Completed |
Stored. |
Failed |
Stopped by an error. |
Refused |
Turned away by the store, which said why. |
Skipped |
Passed over because an earlier file failed or was refused under FileUploaderOptions.StopOnFailure. |
RolledBack |
Stored, then removed because another file failed or was refused under FileUploaderOptions.RollbackOnFailure. |
Canceled |
Abandoned when the upload was canceled. |
License
Apache License 2.0, under the repository's LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- formaui-net.Framework.Resources (= 1.0.0-preview.27)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on formaui-net.Framework.Files:
| Package | Downloads |
|---|---|
|
formaui-net.Blazor
A Blazor component library for .NET 11: form inputs and pickers, dialogs, popovers and toasts, toolbars and menus, tabs and layout, file pickers, uploaders and viewers, icons, emoji and windows. |
|
|
formaui-net.Blazor.Explorer
FormaExplorer, a file manager for the Forma component library over items and folders the host already holds: a folder tree, an address bar with history and breadcrumbs, thumbnail, details and list views, search, sorting and grouping, selection, drag and drop between folders, upload, and a preview of any item. |
|
|
formaui-net.Blazor.Composer
FormaComposer, a rich text authoring surface for Blazor: an editor with the toolbar, dialogs, views and attachments an article or a page body needs, assembled from plugins the host picks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.27 | 58 | 12/3/2026 |
| 1.0.0-preview.26 | 70 | 12/3/2026 |
| 1.0.0-preview.25 | 71 | 12/2/2026 |
| 1.0.0-preview.24 | 87 | 12/1/2026 |
| 1.0.0-preview.23 | 131 | 11/30/2026 |
| 1.0.0-preview.22 | 123 | 11/30/2026 |
| 1.0.0-preview.21 | 124 | 11/29/2026 |
| 1.0.0-preview.20 | 120 | 11/26/2026 |
| 1.0.0-preview.19 | 132 | 11/26/2026 |
| 1.0.0-preview.18 | 120 | 11/26/2026 |
| 1.0.0-preview.17 | 108 | 11/26/2026 |
| 1.0.0-preview.16 | 114 | 11/24/2026 |
| 1.0.0-preview.15 | 107 | 11/23/2026 |
| 1.0.0-preview.14 | 107 | 11/23/2026 |
| 1.0.0-preview.13 | 102 | 11/21/2026 |
| 1.0.0-preview.12 | 104 | 11/20/2026 |
| 1.0.0-preview.11 | 115 | 11/18/2026 |
| 1.0.0-preview.10 | 105 | 11/17/2026 |
| 1.0.0-preview.9 | 136 | 11/17/2026 |
| 1.0.0-preview.8 | 114 | 11/17/2026 |
What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md