Tab

FileSystemProviderBase.UploadFile(FileManagerFolder, String, Stream) Method

Override this method to implement a file upload.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.1.dll

Declaration

public virtual void UploadFile(
    FileManagerFolder folder,
    string fileName,
    Stream content
)

Parameters

Name Type Description
folder FileManagerFolder

A FileManagerFolder object that is a folder to which the file is being uploaded.

fileName String

A string value specifying the file name.

content Stream

A Stream that is the file content.

Remarks

If you create a custom file system provider inherited from the FileSystemProviderBase class, you can override the UploadFile method to upload a file.

By default, the method has no implementation and should be overridden if a file upload is allowed (the FileManagerSettingsUpload.Enabled property is set to true).

Example

using DevExpress.Web.ASPxFileManager;
using System.IO;
public class LinqFileSystemProvider : FileSystemProviderBase {
    const int DbRootItemId = 1;
    DbFileSystemDataContext dataContext;
    Dictionary<int, DbFileSystemItem> folderCache;
    string rootFolderDisplayName;

    public LinqFileSystemProvider(string rootFolder)
        : base(rootFolder) {
        this.dataContext = new DbFileSystemDataContext();
        RefreshFolderCache();
    }

    public DbFileSystemDataContext DataContext { get { return dataContext; } }

    // Used to decrease the number of recursive LINQ to SQL queries made to a database
    public Dictionary<int, DbFileSystemItem> FolderCache { get { return folderCache; } }


    public override string RootFolderDisplayName { get { return rootFolderDisplayName; } }

    public override IEnumerable<FileManagerFile> GetFiles(FileManagerFolder folder) {
        DbFileSystemItem dbFolderItem = FindDbFolderItem(folder);
        return
            from dbItem in DataContext.DbFileSystemItems
            where !dbItem.IsFolder && dbItem.ParentId == dbFolderItem.Id
            select new FileManagerFile(this, folder, dbItem.Name);
    }
    public override