using DevExtreme.AspNet.Mvc.FileManagement; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore.Infrastructure.Internal; using System.Collections.Generic; namespace DevExtreme.NETCore.Demos.Controllers { public class FileManagerScriptsApiController : Controller { IWebHostEnvironment _webHostEnvironment; public FileManagerScriptsApiController(IWebHostEnvironment webHostEnvironment) { _webHostEnvironment = webHostEnvironment; } [HttpGet] [HttpPost] [Route("api/file-manager-file-system", Name = "FileManagementFileSystemApi")] public object FileSystem(FileSystemCommand command, string arguments, int orderId) { string path = Request.Headers["TestHeader"]; var valami = new List(); var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new PhysicalFileSystemProvider(_webHostEnvironment.ContentRootPath + $"/wwwroot/uploads/orders/order{path}"), //uncomment the code below to enable file/folder management //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowDelete = true, //AllowRename = true, //AllowUpload = true, //AllowDownload = true, AllowedFileExtensions = new[] { ".pdf", ".jpg", ".jpeg" } }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return result.GetClientCommandResult(); } } }