Plugin.Maui.SmartUpload 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Plugin.Maui.SmartUpload --version 1.0.0
                    
NuGet\Install-Package Plugin.Maui.SmartUpload -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Maui.SmartUpload" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.SmartUpload" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.SmartUpload" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Maui.SmartUpload --version 1.0.0
                    
#r "nuget: Plugin.Maui.SmartUpload, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plugin.Maui.SmartUpload@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Maui.SmartUpload&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.SmartUpload&version=1.0.0
                    
Install as a Cake Tool

Plugin.Maui.SmartUpload

NuGet

A .NET MAUI plugin for Android and iOS that uploads files in chunks, retries failed slices, and can pause, resume, and survive process death.

  • Chunked HTTP uploads with configurable slice size
  • Pause / resume from the last acknowledged byte
  • Automatic retry with exponential backoff
  • Session persistence on disk (JSON in app data)
  • Built-in Content-Range and tus.io protocols
  • Pluggable IUploadProtocol for custom backends
  • net10.0 reference assembly so shared code and unit tests can use the same API

Install

Package: https://www.nuget.org/packages/Plugin.Maui.SmartUpload

dotnet add package Plugin.Maui.SmartUpload

Or reference the project:

<ProjectReference Include="..\src\Plugin.Maui.SmartUpload\Plugin.Maui.SmartUpload.csproj" />

Register the plugin

builder
    .UseMauiApp<App>()
    .UseSmartUpload(options =>
    {
        options.EnableLogging = true;
        options.DefaultChunkSize = 512 * 1024;
        options.MaxConcurrentUploads = 2;
        options.ResumeInterruptedOnStart = true;
        options.DefaultRetry = new RetryPolicy
        {
            MaxRetries = 5,
            InitialDelay = TimeSpan.FromSeconds(1),
            MaxDelay = TimeSpan.FromSeconds(30)
        };
    });

Resolve ISmartUploadClient from dependency injection, or use SmartUpload.Current.

Enqueue an upload

var client = SmartUpload.Current;

var session = await client.EnqueueAsync(new UploadRequest
{
    FilePath = photoPath,
    Endpoint = new Uri("https://tusd.tusdemo.net/files/"),
    Protocol = UploadProtocolKind.Tus,
    Headers =
    {
        ["Authorization"] = "Bearer token"
    },
    Metadata =
    {
        ["album"] = "vacation"
    }
});

AutoStart defaults to true. Set it to false to persist the session and start later.

Pause, resume, retry

await client.PauseAsync(session.SessionId);
await client.ResumeAsync(session.SessionId);
await client.RetryAsync(session.SessionId);
await client.CancelAsync(session.SessionId);
await client.RemoveAsync(session.SessionId);

var all = await client.GetSessionsAsync();

Progress and lifecycle events:

client.ProgressChanged += (_, e) =>
    Debug.WriteLine($"{e.Session.FileName}: {e.Progress.Fraction:P0}");

client.SessionCompleted += (_, e) =>
    Debug.WriteLine($"Done {e.Session.SessionId}");

client.SessionFailed += (_, e) =>
    Debug.WriteLine($"{e.Error}: {e.Message}");

After a crash, persisted sessions remain on disk. Call ResumeInterruptedAsync, or set ResumeInterruptedOnStart.

Protocols

Protocol How it talks to the server
ContentRange PUT/POST each slice with Content-Range: bytes start-end/total, X-Upload-Id, X-Chunk-Index, and X-Chunk-Count. Optional HEAD can return Range or X-Last-Byte so the client can catch up.
Tus tus 1.0: POST to create, HEAD for Upload-Offset, PATCH with application/offset+octet-stream.
Custom Supply UploadRequest.CustomProtocol or SmartUploadOptions.CustomProtocol.

Content-Range example request:

PUT /upload HTTP/1.1
Content-Range: bytes 0-1048575/10485760
Content-Length: 1048576
X-Upload-Id: 2f1c9a0e...
X-Chunk-Index: 0
X-Chunk-Count: 10

Persistence

Sessions are stored as JSON files under:

FileSystem.AppDataDirectory/Plugin.Maui.SmartUpload/

Each record keeps the file path, size, last-write timestamp, endpoint, headers, protocol state (including the tus Location), and the acknowledged byte offset. If the source file is deleted or rewritten, resume fails with UploadError.FileChanged.

Provide SmartUploadOptions.Store or StorageDirectory to replace the default file store.

Host app setup

Android

The package declares INTERNET and ACCESS_NETWORK_STATE. Keep those permissions in the host manifest if you merge manifests manually.

Large uploads that must continue while the UI is gone still need a host-app foreground service. This plugin persists progress so you can resume when the process starts again.

iOS

HTTPS endpoints work with App Transport Security. For http:// you must allow arbitrary loads.

iOS may suspend the app; unfinished sessions stay on disk and resume on the next launch. Long-running background transfers still need a host-app NSURLSession background configuration if the OS must continue the transfer after the app is killed.

Isolated client (tests)

using var client = SmartUpload.Create(new SmartUploadOptions
{
    Store = new MyStore(),
    HttpClient = httpClient,
    DefaultChunkSize = 64 * 1024,
    DefaultRetry = RetryPolicy.None
});

SmartUpload.Create does not replace SmartUpload.Current.

Sample

samples/SmartUpload.Sample creates a 1 MB file (or picks one), uploads it with tus or Content-Range, and exercises pause / resume / retry / cancel.

dotnet build src/Plugin.Maui.SmartUpload/Plugin.Maui.SmartUpload.csproj
dotnet pack src/Plugin.Maui.SmartUpload/Plugin.Maui.SmartUpload.csproj -c Release
dotnet test tests/Plugin.Maui.SmartUpload.Tests/Plugin.Maui.SmartUpload.Tests.csproj
dotnet build samples/SmartUpload.Sample/SmartUpload.Sample.csproj -f net10.0-android

Pack

dotnet pack src/Plugin.Maui.SmartUpload/Plugin.Maui.SmartUpload.csproj -c Release

Packages are written to artifacts/.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Plugin.Maui.SmartUpload:

Package Downloads
Plugin.Maui.Observability

Umbrella telemetry pipeline for .NET MAUI on iOS and Android. Unifies AppHealth, NetworkMonitor, ApiResilience, BackgroundTasks, OfflineSync, SmartUpload, and DeviceSession into one signal stream, and exports to OpenTelemetry, Application Insights, Sentry, Datadog, Console, or a custom HTTP endpoint.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7 35 9/3/2026
1.0.6 72 9/2/2026
1.0.5 99 8/30/2026
1.0.4 104 8/30/2026
1.0.3 96 8/28/2026
1.0.2 93 8/28/2026
1.0.1 110 8/28/2026
1.0.0 107 8/27/2026

Initial release: chunked, resumable uploads with retry, pause/resume, persistence, Content-Range, and tus.io support for Android and iOS.