Class UploadService
Inheritance
UploadService
Assembly: AjaxUploader.dll
Syntax
public class UploadService : IUploadService
Constructors
UploadService()
Declaration
UploadService(IUploaderProvider)
Declaration
public UploadService(IUploaderProvider provider)
Parameters
Methods
CompleteChunkedUpload(string, string, int)
Completes a chunked upload by assembling chunks and finalizing progress state.
The returned result contains the final stored file GUID and size.
Declaration
public UploadResult CompleteChunkedUpload(string uploadId, string fileName, int totalChunks)
Parameters
Returns
CopyFile(Guid, string)
Copies a stored uploaded file to a new destination path.
This keeps the original stored upload intact.
Declaration
public void CopyFile(Guid fileGuid, string destinationPath)
Parameters
| Type |
Name |
Description |
| Guid |
fileGuid |
|
| string |
destinationPath |
|
DeleteFile(Guid)
Deletes a stored uploaded file.
Declaration
public void DeleteFile(Guid fileGuid)
Parameters
| Type |
Name |
Description |
| Guid |
fileGuid |
|
GetFileInfo(Guid)
Gets metadata for a stored uploaded file.
Returns null when the file no longer exists.
Declaration
public UploadedFileInfo GetFileInfo(Guid fileGuid)
Parameters
| Type |
Name |
Description |
| Guid |
fileGuid |
|
Returns
MoveFile(Guid, string)
Moves a stored uploaded file to a new destination path.
This is typically used when promoting a temporary upload into permanent storage.
Declaration
public void MoveFile(Guid fileGuid, string destinationPath)
Parameters
| Type |
Name |
Description |
| Guid |
fileGuid |
|
| string |
destinationPath |
|
OpenFile(Guid)
Opens a stored uploaded file for reading.
Callers are responsible for disposing the returned stream.
Declaration
public Stream OpenFile(Guid fileGuid)
Parameters
| Type |
Name |
Description |
| Guid |
fileGuid |
|
Returns
UploadChunk(string, int, int, string, long, Stream)
Saves one chunk of a chunked upload and updates progress state.
Validation is performed on the first chunk before any data is persisted.
Declaration
public UploadResult UploadChunk(string uploadId, int chunkIndex, int totalChunks, string fileName, long totalFileSize, Stream chunkStream)
Parameters
Returns
UploadFile(Stream, string, long, string)
Uploads a complete file in one request.
The file is validated first, then saved through the configured provider.
Declaration
public UploadResult UploadFile(Stream fileStream, string fileName, long fileSize, string contentType = null)
Parameters
Returns
ValidateFile(string, long)
Validates the file name and file size against current configuration rules.
Returns null when the file is valid; otherwise returns a human-readable error message.
Declaration
public string ValidateFile(string fileName, long fileSize)
Parameters
| Type |
Name |
Description |
| string |
fileName |
|
| long |
fileSize |
|
Returns
Implements