Interface IMediaImportService
Provides methods for importing media files into Umbraco.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IMediaImportService
Methods
View SourceImportAsync(string, Stream, Guid?, string?, Guid)
Imports a media file asynchronously.
Declaration
Task<IMedia> ImportAsync(string fileName, Stream fileStream, Guid? parentId, string? mediaTypeAlias, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The name of the file being imported. |
| Stream | fileStream | The stream containing the file data. |
| Guid? | parentId | The parent folder identifier, or null to import at the root. |
| string | mediaTypeAlias | The media type alias, or null to auto-detect. |
| Guid | userKey | The key of the user performing the import. |
Returns
| Type | Description |
|---|---|
| Task<IMedia> | A task that represents the asynchronous operation. The task result contains the imported IMedia. |