Search Results for

Show / Hide Table of Contents

# Class FileSystemProvider

Default provider that stores uploads and metadata in the local file system.

##### Inheritance

object
FileSystemProvider

##### Implements

IUploaderProvider

##### Inherited Members

object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

###### Namespace: AjaxUploader.Providers

###### 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)

Initializes a new instance of the FileSystemProvider class.

##### 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

Type | Name | Description
--- | --- | ---
Guid | guid |
string | fileName |
Stream | stream |

#### 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

Type | Name | Description
--- | --- | ---
string | uploadId |
string | fileName |
int | totalChunks |

##### Returns

Type | Description
--- | ---
Guid |

#### 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

Type | Description
--- | ---
int |

#### 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

Type | Description
--- | ---
string |

#### 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

Type | Description
--- | ---
UploadedFileInfo |

#### 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

Type | Description
--- | ---
long |

#### Maintain()

Removes expired temporary uploads and stale chunk folders. Files marked as persisted are preserved.

##### Declaration

    public void Maintain()

#### 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

Type | Description
--- | ---
Stream |

#### 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

Type | Name | Description
--- | --- | ---
Guid | guid |
string | fileName |
Stream | stream |

#### 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

Type | Name | Description
--- | --- | ---
string | uploadId |
int | chunkIndex |
Stream | stream |

### Implements

IUploaderProvider