Interface IUploadService
Defines the high-level upload operations used by CoreUpload endpoints and integrations.
Implementations coordinate validation, storage, chunk assembly, retrieval, and lifecycle operations.
Assembly: CoreUpload.dll
Syntax
public interface IUploadService
Methods
CompleteChunkedUploadAsync(string, string, int, CancellationToken)
Finalizes a chunked upload by assembling the stored chunks into a saved file.
Declaration
Task<UploadResult> CompleteChunkedUploadAsync(string uploadId, string fileName, int totalChunks, CancellationToken ct = default)
Parameters
Returns
CopyFileAsync(Guid, string, CancellationToken)
Copies an uploaded file to another destination while keeping the original upload intact.
Declaration
Task CopyFileAsync(Guid fileGuid, string destinationPath, CancellationToken ct = default)
Parameters
Returns
DeleteFileAsync(Guid, CancellationToken)
Deletes a previously uploaded file and its metadata.
Declaration
Task DeleteFileAsync(Guid fileGuid, CancellationToken ct = default)
Parameters
Returns
GetChunkStatusAsync(string, CancellationToken)
Gets the chunk indexes (and stored byte sizes) the server currently holds
for an upload session, so a resuming client can re-upload anything missing.
Returns null when the storage provider cannot enumerate chunks.
Declaration
Task<IReadOnlyDictionary<int, long>?> GetChunkStatusAsync(string uploadId, CancellationToken ct = default)
Parameters
Returns
GetFileInfoAsync(Guid, CancellationToken)
Gets metadata for a previously uploaded file.
Returns null when the file is no longer available.
Declaration
Task<UploadedFileInfo?> GetFileInfoAsync(Guid fileGuid, CancellationToken ct = default)
Parameters
Returns
MoveFileAsync(Guid, string, CancellationToken)
Moves an uploaded file to a permanent destination path.
Declaration
Task MoveFileAsync(Guid fileGuid, string destinationPath, CancellationToken ct = default)
Parameters
Returns
OpenFileAsync(Guid, CancellationToken)
Opens a readable stream for an uploaded file.
The caller is responsible for disposing the returned stream.
Declaration
Task<Stream> OpenFileAsync(Guid fileGuid, CancellationToken ct = default)
Parameters
Returns
UploadChunkAsync(string, int, int, string, long, Stream, CancellationToken)
Stores one chunk for an upload session and updates progress tracking for that session.
Declaration
Task<UploadResult> UploadChunkAsync(string uploadId, int chunkIndex, int totalChunks, string fileName, long totalFileSize, Stream chunkStream, CancellationToken ct = default)
Parameters
Returns
UploadFileAsync(Stream, string, long, string?, CancellationToken)
Uploads a single file stream and returns an UploadResult describing the saved file.
Declaration
Task<UploadResult> UploadFileAsync(Stream fileStream, string fileName, long fileSize, string? contentType = null, CancellationToken ct = default)
Parameters
Returns
ValidateFile(string, long, string?)
Validates a file name, size, and optional MIME type against the current server rules.
Returns null when the file is valid; otherwise returns an error message.
Declaration
string? ValidateFile(string fileName, long fileSize, string? contentType = null)
Parameters
Returns