New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Provides storage independent mechanism for uploading files and populating the content of the FileBrowser dialog controls.

Definition

Namespace:Telerik.Web.UI.Widgets

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public abstract class FileBrowserContentProvider

Inheritance: objectFileBrowserContentProvider

Derived Classes: FileSystemContentProvider

Inherited Members object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
protected FileBrowserContentProvider()

Creates a new instance of the class. Used internally by FileManager to create instances of the content provider.

C#
protected FileBrowserContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
Parameters:contextHttpContext

The current HttpContext.

searchPatternsstring[]

Search patterns for files. Allows wildcards.

viewPathsstring[]

The paths which will be displayed in the FileManager. You can disregard this value if you have custom mechanism for determining the rights for directory / file displaying.

uploadPathsstring[]

The paths which will allow uploading in the FileManager. You can disregard this value if you have custom mechanism for determining the rights for uploading.

deletePathsstring[]

The paths which will allow deleting in the dialog. You can disregard this value if you have custom mechanism for determining the rights for deleting.

selectedUrlstring

The selected url in the file browser. The file browser will navigate to the item which has this url.

selectedItemTagstring

The selected tag in the file browser. The file browser will navigate to the item which has this tag.

Properties

C#
protected virtual string ApplicationPath { get; }

Gets a value indicating whether the ContentProvider can create directory items or not. The visibility of the Create New Directory icon is controlled by the value of this property.

C#
public virtual bool CanCreateDirectory { get; }

The HttpContext object, set in the constructor of the class.

C#
protected HttpContext Context { get; }

The paths which will allow deleting in the dialog. This is passed by RadEditor and is one of the values of DeleteImagesPaths, DeleteDocumentsPaths, DeleteMediaPaths, DeleteFlashPaths, DeleteTemplatesPaths properties. You can disregard this value if you have custom mechanism for determining the rights for deleting.

C#
protected string[] DeletePaths { get; }

The character, used to separate parts of the virtual path (e.g. '/' is the path separator in /path1/path2/file)

C#
public virtual char PathSeparator { get; }

Gets the search patterns for the file items to be displayed in the FileBrowser control. This property is set in the constructor of the class. Supports wildcards.

C#
protected string[] SearchPatterns { get; }

Gets or sets the tag of the selected item. The file browser will navigate to the item which has this tag. Used mainly in Database content providers, where the file items have special url for accessing.

C#
[Obsolete("This property is no longer used")]
protected string SelectedItemTag { get; set; }

Gets or sets the url of the selected item. The file browser will navigate to the item which has this url.

C#
protected string SelectedUrl { get; set; }

Gets the paths which will allow uploading in the dialog. This is passed by RadEditor and is one of the values of UploadImagesPaths, UploadDocumentsPaths, UploadMediaPaths, UploadFlashPaths, UploadTemplatesPaths properties. You can disregard this value if you have custom mechanism for determining the rights for uploading.

C#
protected string[] UploadPaths { get; }

Gets the paths which will be displayed in the dialog. This is passed by RadEditor and is one of the values of ImagesPaths, DocumentsPaths, MediaPaths, FlashPaths, TemplatesPaths properties. You can disregard this value if you have custom mechanism for determining the rights for directory / file displaying.

C#
protected string[] ViewPaths { get; }

Methods

Checks if the current configuration allows deleting from the specified folder

C#
public virtual bool CheckDeletePermissions(string folderPath)
Parameters:folderPathstring

the virtual path that will be checked

Returns:

bool

true if deleting is allowed, otherwise false

Checks if the current configuration allows reading from the specified folder

C#
public virtual bool CheckReadPermissions(string folderPath)
Parameters:folderPathstring

The virtual path that will be checked

Returns:

bool

True if reading is allowed, otherwise false

Checks if the current configuration allows writing (uploading) to the specified folder

C#
public virtual bool CheckWritePermissions(string folderPath)
Parameters:folderPathstring

the virtual path that will be checked

Returns:

bool

true if writing is allowed, otherwise false

Copies a directory from a one virtual path to a new one

C#
public virtual string CopyDirectory(string path, string newPath)
Parameters:pathstring

old virtual location

newPathstring

new virtual location

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Copies a file from a one virtual path to a new one.

C#
public virtual string CopyFile(string path, string newPath)
Parameters:pathstring

old virtual location

newPathstring

new virtual location

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Creates a directory item in the given path with the given name.

C#
public abstract string CreateDirectory(string path, string name)
Parameters:pathstring

The path where the directory item should be created.

namestring

The name of the new directory item.

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Deletes the directory item with the given virtual path.

C#
public abstract string DeleteDirectory(string path)
Parameters:pathstring

The virtual path of the directory item.

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Deletes the file item with the given virtual path.

C#
public abstract string DeleteFile(string path)
Parameters:pathstring

The virtual path of the file item.

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Gets a read only Stream for accessing the file item with the given url.

C#
public abstract Stream GetFile(string url)
Parameters:urlstring

The url of the file.

Returns:

Stream

Stream for accessing the contents of the file item with the given url.

C#
public virtual FileItem GetFileItem(string path)
Parameters:pathstringReturns:

FileItem

Get the name of the file with the given url.

C#
public abstract string GetFileName(string url)
Parameters:urlstring

The url of the file.

Returns:

string

String containing the file name.

Gets the virtual path of the item with the given url.

C#
public abstract string GetPath(string url)
Parameters:urlstring

The url of the item.

Returns:

string

String containing the path of the item.

Moves a directory from a one virtual path to a new one. This method can also be used for renaming items.

C#
public virtual string MoveDirectory(string path, string newPath)
Parameters:pathstring

old virtual location

newPathstring

new virtual location

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Moves a file from a one virtual path to a new one. This method can also be used for renaming items.

C#
public virtual string MoveFile(string path, string newPath)
Parameters:pathstring

old virtual location

newPathstring

new virtual location

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Normalizes paths that contain parent references - /..

C#
public string NormalizeRelativePath(string path)
Parameters:pathstring

The path that will be normalized

Returns:

string

The normalized path that now points directly to its target

Removes the protocol and the server names from the given url.

C#
public static string RemoveProtocolNameAndServerName(string url)
Parameters:urlstring

Fully qualified url to a file or directory item.

Returns:

string

The root based absolute path.

Url: http://www.myserver.com/myapp/mydirectory/myfile Result: /myapp/mydirectory/myfile

Url: www.myserver.com/myapp/mydirectory/myfile Result: /myapp/mydirectory/myfile

Resolves a directory with the given path. This method populates the Files collection in the returned DirectoryItem

C#
public abstract DirectoryItem ResolveDirectory(string path)
Parameters:pathstring

The virtual path of the directory.

Returns:

DirectoryItem

A DirectoryItem, containing the directory.

Used mainly in the Ajax calls.

Resolves a root directory with the given path in list mode.

C#
[Obsolete("This method is no longer used. Only Tree display mode is supported.")]
public virtual DirectoryItem[] ResolveRootDirectoryAsList(string path)
Parameters:pathstring

The virtual path of the directory.

Returns:

DirectoryItem[]

A DirectoryItem array, containing the root directory and all child directories.

Resolves a root directory with the given path in tree mode. This method populates the Directories collection in the returned DirectoryItem

C#
public abstract DirectoryItem ResolveRootDirectoryAsTree(string path)
Parameters:pathstring

The virtual path of the directory.

Returns:

DirectoryItem

A DirectoryItem, containing the root directory.

C#
public FileBrowserRoot ResolveViewPaths()
Returns:

FileBrowserRoot

Stores an image with the given url and image format.

C#
public abstract string StoreBitmap(Bitmap bitmap, string url, ImageFormat format)
Parameters:bitmapBitmap

The Bitmap object to be stored.

urlstring

The url of the bitmap.

formatImageFormat

The image format of the bitmap.

Returns:

string

string.Empty when the operation was successful; otherwise an error message token.

Used when creating thumbnails in the ImageManager dialog.

Creates a file item from a HttpPostedFile to the given path with the given name.

C#
[Obsolete("Please use the other overload of StoreFile()")]
public virtual string StoreFile(HttpPostedFile file, string path, string name, params string[] arguments)
Parameters:fileHttpPostedFile

The uploaded HttpPostedFile to store.

pathstring

The virtual path where the file item should be created.

namestring

The name of the file item.

argumentsstring[]

Additional values to be stored such as Description, DisplayName, etc.

Returns:

string

String containing the full virtual path (including the file name) of the file item.

The default FileUploader control does not include the arguments parameter. If you need additional arguments you should create your own FileUploader control.

Creates a file item from a Telerik.Web.UI.UploadedFile in the given path with the given name.

C#
public abstract string StoreFile(UploadedFile file, string path, string name, params string[] arguments)
Parameters:fileUploadedFile

The UploadedFile instance to store.

pathstring

The virtual path where the file item should be created.

namestring

The name of the file item.

argumentsstring[]

Additional values to be stored such as Description, DisplayName, etc.

Returns:

string

String containing the full virtual path (including the file name) of the file item.

The default FileUploader control does not include the arguments parameter. If you need additional arguments you should create your own FileUploader control.