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
CompleteChunkedUpload(string, string, int, string)
Completes a chunked upload, also recording the sanitized
folder-relative path supplied by folder uploads (or null).
Declaration
public UploadResult CompleteChunkedUpload(string uploadId, string fileName, int totalChunks, string relativePath)
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 |
|
GetChunkStatus(string)
Gets the chunk indexes and stored 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 (custom providers without a GetSavedChunks implementation).
Declaration
public Dictionary<int, long> GetChunkStatus(string uploadId)
Parameters
| Type |
Name |
Description |
| string |
uploadId |
|
Returns
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
GetFilePath(Guid)
Returns the stored file's full path for file-system-backed providers,
or null otherwise (v4's GetTempFilePath contract).
Declaration
public string GetFilePath(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
UploadFile(Stream, string, long, string, string)
Validates and saves a file, also recording the sanitized
folder-relative path supplied by folder uploads (or null).
Declaration
public UploadResult UploadFile(Stream fileStream, string fileName, long fileSize, string contentType, string relativePath)
Parameters
Returns
ValidateFile(string, long, string)
Validates the file name, file size, and optional MIME type 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, string contentType = null)
Parameters
Returns
Implements