UFile.PartialUploader
1.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package UFile.PartialUploader --version 1.0.6
NuGet\Install-Package UFile.PartialUploader -Version 1.0.6
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="UFile.PartialUploader" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UFile.PartialUploader --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: UFile.PartialUploader, 1.0.6"
#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.
// Install UFile.PartialUploader as a Cake Addin #addin nuget:?package=UFile.PartialUploader&version=1.0.6 // Install UFile.PartialUploader as a Cake Tool #tool nuget:?package=UFile.PartialUploader&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
The UFile library facilitates the uploading and processing of large files by handling them in smaller chunks. It provides functionality to save chunks, retry failed uploads, merge chunks into the final file, and store the completed file in a specified directoryThis approach is particularly useful for improving upload reliability and efficiency, especially for large files or unstable network conditions.
Examples
dotnet add package UFile.PartialUploader
public static IServiceCollection AddServices(this IServiceCollection services, IConfiguration conf)
{
// Adds the UFile service to the specified service collection.
services.AddUFile("App_Data", "tmp");
return services;
}
[Route("api/[controller]")]
[ApiController]
public class FileController(IUFileService uFileService) : ControllerBase
{
[HttpPost("upload")]
public async Task<IActionResult> Upload() => StatusCode((int)await uFileService.UploadChunkFiles(Request));
}
npm install partial-uploader
const file = event.target.files[0];
uploadFile = (file: File) => uploadWithPartialFile("/File/upload", file,
//you can add header here
{ "Authorization": `Bearer ${token}` });
let uploadResponse = await uploadFile(file);
if (uploadResponse.success)
{
// your file will be inside the folder at this location
const path = 'App_Data/tmp/' + uploadResponse.id;
}
var fileInfo = UFileHelper.GetFileInfo(tempFolderId);
// Server Side Upload
public class Test(IUFileService uFileService)
{
public async Task Upload()
{
string url = "https://example.com/upload";
string filePath = "path/to/your/file.txt";
// Headers add if available
Dictionary<string, string> headers = new Dictionary<string, string>
{
{ "Authorization", "Bearer your_token" }
};
try
{
using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
var (success, id, message) = await uFileService.UploadWithPartialFileAsync(url, fileStream, Path.GetFileName(filePath), headers);
Console.WriteLine($"Success: {success}, ID: {id}, Message: {message}");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.