Your search did not match any results.

Overview

The DevExtreme HTML5 JavaScript File Manager widget allows you to display and manage files and directories for different file systems. The File Manager uses file providers to access file systems. Use the fileProvider option to configure the widget's file provider. The "File System Types" demo group illustrates how to use the FileManager widget with different file providers.

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

Use the widget's itemView option 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.

@(Html.DevExtreme().FileManager() .CurrentPath("Widescreen") .FileProvider(fileProvider => fileProvider .Remote() .Url(Url.RouteUrl("FileManagementImagesApi"))) .Permissions(permissions => permissions .Create(true) .Copy(true) .Move(true) .Remove(true) .Rename(true) .Upload(true) .Download(true)) .OnSelectedFileOpened(@<text> function(e) { var popup = $("#photo-popup").dxPopup("instance"); popup.option({ "title": e.fileItem.name, "contentTemplate": "<img src=\"https://js.devexpress.com/Demos/NetCore" + e.fileItem.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>) .CloseOnOutsideClick(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(IHostingEnvironment hostingEnvironment) { HostingEnvironment = hostingEnvironment; } public IHostingEnvironment HostingEnvironment { 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 DefaultFileProvider( Path.Combine(HostingEnvironment.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, //AllowRemove = 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) { return fileSystemItem.FullName .Replace(HostingEnvironment.WebRootPath, "") .Replace(Path.DirectorySeparatorChar, '/'); } } }
.photo-popup-content { text-align: center; } .photo-popup-content .photo-popup-image { height: 100%; max-width: 100%; }