Table of Contents

Class FileHelper

Namespace
CMS.Helpers
Assembly
CMS.Helpers.dll

File helper methods.

public static class FileHelper
Inheritance
object
FileHelper

Methods

FilesLocationType()

Gets the files location type.

public static FilesLocationTypeEnum FilesLocationType()

Returns

FilesLocationTypeEnum

GetFullFileName(string, string, int, int)

Returns full file name ([name.extension] if extension is specified) or ([name] only if extension is not specified), If width and height are specified, thumbnail file name is generated.

public static string GetFullFileName(string fileName, string fileExtension, int width = 0, int height = 0)

Parameters

fileName string

File name

fileExtension string

File extension

width int

Image width

height int

Image height

Returns

string

GetFullFilePhysicalPath(string, string)

Returns full physical path of a file or folder. Does not change the ending slash

public static string GetFullFilePhysicalPath(string path, string webFullPath = null)

Parameters

path string

Path

webFullPath string

Full path to the root of the web project (e.g. c:\WebProject)

Returns

string

GetFullFolderPhysicalPath(string, string)

Returns full physical path for a folder. Ensures the trailing slash.

public static string GetFullFolderPhysicalPath(string path, string webFullPath = null)

Parameters

path string

Path

webFullPath string

Full path to the root of the web project (e.g. c:\WebProject)

Returns

string

GetPhysicalPath(string)

Returns the physical file path that corresponds to the specified virtual path on the web server.

public static string GetPhysicalPath(string path)

Parameters

path string

File virtual path

Returns

string

Exceptions

ArgumentException

path contains illegal characters

GetUniqueDirectoryName(string)

Returns dirPath based on the given direPath which is unique within the parent folder. If the path is relative, relative path is returned, if the input path was absolute, absolute path is returned.

public static string GetUniqueDirectoryName(string dirPath)

Parameters

dirPath string

Directory path (relative with ~/ or absolute)

Returns

string