menu

ASP.NET MVC

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class BasicFileOperations

    Show / Hide Table of Contents

    Class BasicFileOperations

    This Class contains the server side file handling functionalities of our FileExplorer component.

    Inheritance
    System.Object
    BasicFileOperations
    FileExplorerOperations
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.JavaScript
    Assembly: Syncfusion.EJ.dll
    Syntax
    public abstract class BasicFileOperations

    Constructors

    BasicFileOperations()

    Declaration
    protected BasicFileOperations()

    Fields

    ContentRootPath

    Declaration
    public string ContentRootPath
    Field Value
    Type Description
    System.String

    Methods

    AddFileToZip(String, String)

    Adds the files to zipped folder.

    Declaration
    public virtual void AddFileToZip(string zipFileName, string fileToAdd)
    Parameters
    Type Name Description
    System.String zipFileName

    Name of the zip file.

    System.String fileToAdd

    The file to add in zip folder.

    CanReplace(String, IEnumerable<CommonFileDetails>)

    Determines whether the file can replace the existing file that is available in given path.

    Declaration
    public virtual bool CanReplace(string path, IEnumerable<CommonFileDetails> commonFiles)
    Parameters
    Type Name Description
    System.String path

    The path.

    System.Collections.Generic.IEnumerable<CommonFileDetails> commonFiles

    Common file details.

    Returns
    Type Description
    System.Boolean

    true if this instance can replace the specified path; otherwise, false.

    CombinePaths(String, String)

    Combines the paths.

    Declaration
    public virtual string CombinePaths(string basePath, string relativePath)
    Parameters
    Type Name Description
    System.String basePath

    The base path.

    System.String relativePath

    The relative path.

    Returns
    Type Description
    System.String

    System.String.

    CompressImage(String, ImageSize)

    Compress the image into small size.

    Declaration
    public virtual void CompressImage(string path, ImageSize targetSize)
    Parameters
    Type Name Description
    System.String path

    Image file path.

    ImageSize targetSize

    Expected image size.

    CreateFolder(String, String, IEnumerable<Object>)

    Creates a new folder in given path with specified name.

    Declaration
    public abstract object CreateFolder(string path, string name, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Parent folder path.

    System.String name

    Name of the new folder.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    DeleteDirectory(String)

    Deletes the directory.

    Declaration
    public virtual void DeleteDirectory(string physicalPath)
    Parameters
    Type Name Description
    System.String physicalPath

    The physical path.

    Download(String, String[], IEnumerable<Object>)

    Downloads the specified files.

    Declaration
    public abstract void Download(string path, string[] names, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Parent directory path of selected files, which is going to be download.

    System.String[] names

    Name of files that is need to be downloaded.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    DownloadZip(String, String[])

    Downloads the zipped folder.

    Declaration
    public virtual void DownloadZip(string path, string[] names)
    Parameters
    Type Name Description
    System.String path

    Download-able file path.

    System.String[] names

    Download-able file names.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Name should not be null

    FindRatio(ImageSize, ImageSize)

    Return new image size without modifying the original image ratio

    Declaration
    public virtual ImageSize FindRatio(ImageSize originalSize, ImageSize targetSize)
    Parameters
    Type Name Description
    ImageSize originalSize

    Original image size.

    ImageSize targetSize

    Expected image size.

    Returns
    Type Description
    ImageSize

    FolderDownload(String, String[], Int32)

    Declaration
    protected void FolderDownload(string path, string[] names, int count)
    Parameters
    Type Name Description
    System.String path
    System.String[] names
    System.Int32 count

    GetDetails(String, String[], IEnumerable<Object>)

    Gets the details about specified file or directory.

    Declaration
    public abstract object GetDetails(string path, string[] names, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Parent directory path of selected file.

    System.String[] names

    File or folder name.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    GetFile(String, IEnumerable<Object>)

    Gets the file.

    Declaration
    public virtual void GetFile(string path, IEnumerable<object> selectedItems)
    Parameters
    Type Name Description
    System.String path

    File path.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Name should not be null

    GetImage(String, Boolean, ImageSize, IEnumerable<Object>)

    Declaration
    public abstract void GetImage(string path, bool canCompress = false, ImageSize size = null, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path
    System.Boolean canCompress
    ImageSize size
    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    GetImage(String, IEnumerable<Object>)

    Gets the image.

    Declaration
    public abstract void GetImage(string path, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    File path.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    GetPhysicalPath(String)

    Gets the physical path.

    Declaration
    public virtual string GetPhysicalPath(string absolutePath)
    Parameters
    Type Name Description
    System.String absolutePath

    The absolute path.

    Returns
    Type Description
    System.String

    System.String.

    isPhysicalPath(String)

    Checks is it local physical folder path or not

    Declaration
    public virtual bool isPhysicalPath(string path)
    Parameters
    Type Name Description
    System.String path

    The folder path.

    Returns
    Type Description
    System.Boolean

    System.Boolean

    isSharedPath(String)

    Checks is it shared path or not

    Declaration
    public virtual bool isSharedPath(string path)
    Parameters
    Type Name Description
    System.String path

    The folder path.

    Returns
    Type Description
    System.Boolean

    System.Boolean

    isSharedServer(String)

    Checks is it shared server root path or not

    Declaration
    public virtual bool isSharedServer(string path)
    Parameters
    Type Name Description
    System.String path

    The folder path.

    Returns
    Type Description
    System.Boolean

    System.Boolean

    MoveDirectory(String, String, IEnumerable<CommonFileDetails>, Boolean)

    Moves the directory.

    Declaration
    public virtual void MoveDirectory(string source, string target, IEnumerable<CommonFileDetails> commonFiles, bool makeDuplicate)
    Parameters
    Type Name Description
    System.String source

    The source path.

    System.String target

    The target path.

    System.Collections.Generic.IEnumerable<CommonFileDetails> commonFiles

    Details about common files.

    System.Boolean makeDuplicate

    if set to true [make duplicate].

    Paste(String, String, String[], String, IEnumerable<CommonFileDetails>, IEnumerable<Object>, IEnumerable<Object>)

    Copy or moves the specified files/ directories from one location to another location.

    Declaration
    public abstract object Paste(string sourceDir, string targetDir, string[] names, string option, IEnumerable<CommonFileDetails> commonFiles, IEnumerable<object> selectedItems = null, IEnumerable<object> targetFolder = null)
    Parameters
    Type Name Description
    System.String sourceDir

    The source directory path.

    System.String targetDir

    The target directory path.

    System.String[] names

    Name of file/ folders, which are going to be pasted in destination folder.

    System.String option

    Operation type “move” or “copy”.

    System.Collections.Generic.IEnumerable<CommonFileDetails> commonFiles

    Existing files list, which contains same name, type and parent path as given in new file.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    System.Collections.Generic.IEnumerable<System.Object> targetFolder

    Details about target folder.

    Returns
    Type Description
    System.Object

    System.Object.

    PasteOperation(String, String, String[], String, IEnumerable<CommonFileDetails>)

    Pastes the files/ directories.

    Declaration
    public virtual string[] PasteOperation(string sourceDir, string targetDir, string[] names, string option, IEnumerable<CommonFileDetails> commonFiles)
    Parameters
    Type Name Description
    System.String sourceDir

    The source directory path.

    System.String targetDir

    The target directory path.

    System.String[] names

    File/ folder names.

    System.String option

    Paste option (copy or move).

    System.Collections.Generic.IEnumerable<CommonFileDetails> commonFiles

    Details about common files.

    Returns
    Type Description
    System.String[]

    System.String[].

    Read(String, String, IEnumerable<Object>)

    Reads all immediate files and sub-folders from the specified path and it returns the matched type of files, which are specified in “filter” parameter.

    Declaration
    public abstract object Read(string path, string filter, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Path of the selected folder.

    System.String filter

    File types to filter.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    Remove(String[], String, IEnumerable<Object>)

    Removes the specified items from given path.

    Declaration
    public abstract object Remove(string[] names, string path, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String[] names

    Removable item names.

    System.String path

    Parent folder path of removable items.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    Rename(String, String, String, IEnumerable<CommonFileDetails>, IEnumerable<Object>)

    Renames the specified file/folder, which is available in given path.

    Declaration
    public abstract object Rename(string path, string oldName, string newName, IEnumerable<CommonFileDetails> commonFiles, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Parent folder path of renaming item.

    System.String oldName

    Existing name.

    System.String newName

    New name.

    System.Collections.Generic.IEnumerable<CommonFileDetails> commonFiles

    Specifies existing files list, which contains same name, type and parent path as given in new file

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    Search(String, String, String, Boolean, IEnumerable<Object>)

    Searches the matched files and sub-folders in the given folder path using search string.

    Declaration
    public abstract object Search(string path, string filter, string searchString, bool caseSensitive, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.String path

    Directory path.

    System.String filter

    File types to filter.

    System.String searchString

    The search string.

    System.Boolean caseSensitive

    If set to true [case sensitive].

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    Returns
    Type Description
    System.Object

    System.Object.

    ToAbsolute(String)

    Converts into the absolute path.

    Declaration
    public virtual string ToAbsolute(string virtualPath)
    Parameters
    Type Name Description
    System.String virtualPath

    The virtual path.

    Returns
    Type Description
    System.String

    System.String.

    Upload(IEnumerable<HttpPostedFileBase>, String, IEnumerable<Object>)

    Uploads the specified files to given path.

    Declaration
    public abstract void Upload(IEnumerable<HttpPostedFileBase> files, string path, IEnumerable<object> selectedItems = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Web.HttpPostedFileBase> files

    Uploading file details.

    System.String path

    Path of destination directory, where the files need to be uploaded.

    System.Collections.Generic.IEnumerable<System.Object> selectedItems

    Details about selected items.

    WildcardToRegex(String)

    Converts wild-cards to reg-expression.

    Declaration
    public virtual string WildcardToRegex(string pattern)
    Parameters
    Type Name Description
    System.String pattern

    The wild-card pattern.

    Returns
    Type Description
    System.String

    System.String.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved