Class FileSystemProvider
Default provider that stores uploads and metadata in the local file system.
Inheritance
FileSystemProvider
Assembly: AjaxUploader.dll
Syntax
public class FileSystemProvider : IUploaderProvider
Constructors
FileSystemProvider()
Initializes a new instance of the FileSystemProvider class using AjaxUploader configuration values.
Declaration
public FileSystemProvider()
FileSystemProvider(string, int)
Declaration
public FileSystemProvider(string tempDirectory, int expiryMinutes)
Parameters
| Type |
Name |
Description |
| string |
tempDirectory |
|
| int |
expiryMinutes |
|
Methods
Append(Guid, string, Stream)
Appends data to an existing temporary upload file.
The metadata entry is updated with the new total size after the append finishes.
Declaration
public void Append(Guid guid, string fileName, Stream stream)
Parameters
AssembleChunks(string, string, int)
Assembles all saved chunks into a final stored upload.
The temporary chunk directory is removed after a successful assembly.
Declaration
public Guid AssembleChunks(string uploadId, string fileName, int totalChunks)
Parameters
Returns
CopyTo(Guid, string)
Copies a stored upload to a new destination path.
The original temporary stored upload remains available afterwards.
Declaration
public void CopyTo(Guid guid, string destinationPath)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
| string |
destinationPath |
|
Delete(Guid)
Deletes a stored upload and its metadata.
Missing files are ignored.
Declaration
public void Delete(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
GetCompletedChunks(string)
Gets the number of completed chunks for a chunked upload session.
Declaration
public int GetCompletedChunks(string uploadId)
Parameters
| Type |
Name |
Description |
| string |
uploadId |
|
Returns
GetFilePath(Guid)
Gets the physical file path for a stored upload when it exists.
This is intended for file-system-backed integrations that need a direct path.
Declaration
public string GetFilePath(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
Returns
GetInfo(Guid)
Gets metadata for a stored upload.
Returns null when the metadata file does not exist.
Declaration
public UploadedFileInfo GetInfo(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
Returns
GetUploadedLength(string)
Gets the total uploaded byte count for a chunked upload session.
This is useful for progress polling and resumable upload logic.
Declaration
public long GetUploadedLength(string uploadId)
Parameters
| Type |
Name |
Description |
| string |
uploadId |
|
Returns
Maintain()
Removes expired temporary uploads and stale chunk folders.
Files marked as persisted are preserved.
Declaration
MoveTo(Guid, string)
Moves a stored upload to a new destination path.
The temporary stored copy and metadata are removed after the move completes.
Declaration
public void MoveTo(Guid guid, string destinationPath)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
| string |
destinationPath |
|
OpenRead(Guid)
Opens a stored upload for reading.
Callers are responsible for disposing the returned stream.
Declaration
public Stream OpenRead(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
Returns
Persist(Guid)
Marks a stored upload as persisted.
Persisted uploads are skipped by routine cleanup.
Declaration
public void Persist(Guid guid)
Parameters
| Type |
Name |
Description |
| Guid |
guid |
|
Save(Guid, string, Stream)
Saves a complete uploaded file to the temporary storage folder.
Metadata is written alongside the upload in a matching .meta file.
Declaration
public void Save(Guid guid, string fileName, Stream stream)
Parameters
SaveChunk(string, int, Stream)
Saves one chunk for a chunked upload session.
Each chunk is written to the session's chunk directory using a zero-padded file name.
Declaration
public void SaveChunk(string uploadId, int chunkIndex, Stream stream)
Parameters
Implements