Your search did not match any results.

Overview

Documentation

The DevExtreme ASP.NET Core FileManager control allows you to display and manage files and directories for different file systems. The FileManager control uses file system providers to access file systems. Use the fileSystemProvider property to configure the control's file system provider. The "File System Types" demo group illustrates how to use the FileManager control with different file system providers.

The control's default security settings provide read-only access to files and directories. Use the permissions property to deny or allow a user to copy, create, move, delete, rename, upload, and download files and directories. You can also specify file restrictions: allowed file extensions (allowedFileExtensions), chunk size (chunkSize) and maximum file size (maxFileSize).

Use the control's itemView property or the view switcher on the toolbar to display file system items as a detailed list or customizable thumbnails.

This demo contains commented out code lines that enable file modification operations. You can uncomment them and configure if necessary.

Backend API
@(Html.DevExtreme().FileManager() .CurrentPath("Widescreen") .FileSystemProvider(provider => provider .Remote() .Url(Url.RouteUrl("FileManagementImagesApi"))) .Permissions(permissions => permissions .Create(true) .Copy(true) .Move(true) .Delete(true) .Rename(true) .Upload(true) .Download(true)) .OnSelectedFileOpened(@<text> function(e) { var popup = $("#photo-popup").dxPopup("instance"); popup.option({ "title": e.file.name, "contentTemplate": "<img src=\"" + e.file.dataItem.url + "\" class=\"photo-popup-image\" />" }); popup.show(); } </text>) .Height(450)) @(Html.DevExtreme().Popup() .ID("photo-popup") .MaxHeight(600) .OnContentReady(@<text> function(e) { var $contentElement = e.component.content(); $contentElement.addClass("photo-popup-content"); } </text>) .HideOnOutsideClick(true) .ShowCloseButton(true))
using DevExtreme.NETCore.Demos.Models.FileManagement; using Microsoft.AspNetCore.Mvc; namespace DevExtreme.NETCore.Demos.Controllers { public class FileManagerController : Controller { public IActionResult Overview() { return View(); } } }
using DevExtreme.AspNet.Mvc.FileManagement; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using System; using System.IO; namespace DevExtreme.NETCore.Demos.Controllers { public class FileManagerImagesApiController : Controller { static readonly string SampleImagesRelativePath = Path.Combine("SampleData", "SampleImages"); public FileManagerImagesApiController(IWebHostEnvironment webHostEnvironment) { WebHostEnvironment = webHostEnvironment; } public IWebHostEnvironment WebHostEnvironment { get; } [Route("api/file-manager-file-system-images", Name = "FileManagementImagesApi")] public object FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new PhysicalFileSystemProvider( Path.Combine(WebHostEnvironment.WebRootPath, SampleImagesRelativePath), (fileSystemItem, clientItem) => { if(!clientItem.IsDirectory) clientItem.CustomFields["url"] = GetFileItemUrl(fileSystemItem); } ), //uncomment the code below to enable file/directory management //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowDelete = true, //AllowRename = true, //AllowUpload = true, AllowDownload = true }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return result.GetClientCommandResult(); } string GetFileItemUrl(FileSystemInfo fileSystemItem) { var relativeUrl = fileSystemItem.FullName .Replace(WebHostEnvironment.WebRootPath, "") .Replace(Path.DirectorySeparatorChar, '/'); return $"{Request.Scheme}://{Request.Host}{Request.PathBase}{relativeUrl}"; } } }
.photo-popup-content { text-align: center; } .photo-popup-content .photo-popup-image { height: 100%; max-width: 100%; }