/// <summary> /// Sets the posted file value of a property. /// </summary> public static void SetValue( this IContentBase content, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, string propertyTypeAlias, string filename, Stream filestream, string culture = null, string segment = null) { if (filename == null || filestream == null) { return; } filename = shortStringHelper.CleanStringForSafeFileName(filename); if (string.IsNullOrWhiteSpace(filename)) { return; } filename = filename.ToLower(); SetUploadFile(content, mediaFileManager, mediaUrlGenerators, contentTypeBaseServiceProvider, propertyTypeAlias, filename, filestream, culture, segment); }
/// <summary> /// Gets the file path of a media file. /// </summary> /// <param name="filename">The file name.</param> /// <param name="cuid">The unique identifier of the content/media owning the file.</param> /// <param name="puid">The unique identifier of the property type owning the file.</param> /// <returns>The filesystem-relative path to the media file.</returns> /// <remarks>With the old media path scheme, this CREATES a new media path each time it is invoked.</remarks> public string GetMediaPath(string filename, Guid cuid, Guid puid) { filename = Path.GetFileName(filename); if (filename == null) { throw new ArgumentException("Cannot become a safe filename.", nameof(filename)); } filename = _shortStringHelper.CleanStringForSafeFileName(filename.ToLowerInvariant()); return(_mediaPathScheme.GetFilePath(this, cuid, puid, filename)); }