Interface ITemporaryFileService
Provides functionality for managing temporary files used during uploads and other operations.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface ITemporaryFileService
Remarks
Temporary files are stored for a limited time and are automatically cleaned up.
Methods
View SourceCleanUpOldTempFiles()
Cleans up expired temporary files.
Declaration
Task<IEnumerable<Guid>> CleanUpOldTempFiles()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Guid>> | A collection of keys for the temporary files that were cleaned up. |
CreateAsync(CreateTemporaryFileModel)
Creates a new temporary file.
Declaration
Task<Attempt<TemporaryFileModel?, TemporaryFileOperationStatus>> CreateAsync(CreateTemporaryFileModel createModel)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateTemporaryFileModel | createModel | The model containing the file data and metadata. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<TemporaryFileModel, TemporaryFileOperationStatus>> | An attempt containing the created temporary file model if successful, or an operation status indicating failure. |
DeleteAsync(Guid)
Deletes a temporary file by its key.
Declaration
Task<Attempt<TemporaryFileModel?, TemporaryFileOperationStatus>> DeleteAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the temporary file to delete. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<TemporaryFileModel, TemporaryFileOperationStatus>> | An attempt containing the deleted temporary file model if successful, or an operation status indicating failure. |
GetAsync(Guid)
Gets a temporary file by its key.
Declaration
Task<TemporaryFileModel?> GetAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the temporary file. |
Returns
| Type | Description |
|---|---|
| Task<TemporaryFileModel> | The temporary file model if found; otherwise, null. |