Class FileHelper
File helper methods.
public static class FileHelper
- Inheritance
-
objectFileHelper
Methods
FilesLocationType()
Gets the files location type.
public static FilesLocationTypeEnum FilesLocationType()
Returns
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
stringFile name
fileExtension
stringFile extension
width
intImage width
height
intImage 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
stringPath
webFullPath
stringFull 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
stringPath
webFullPath
stringFull 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
stringFile 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
stringDirectory path (relative with ~/ or absolute)
Returns
- string