|
public class HomeController : Controller
{
public PhysicalFileProvider operation;
public string basePath;
string root = "wwwroot\\Files\\Documents";
……………..
……………..
public object FileOperations([FromBody] FileManagerDirectoryContent args)
{
this.operation.RootFolder(this.basePath + "\\" + this.root);
…………….
…………….
}
public IActionResult Upload(string path, IList<IFormFile> uploadFiles, string action, string user_name)
{
this.operation.RootFolder(this.basePath + "\\" + this.root);
……………..
……………..
}
public IActionResult Download(string downloadInput)
{
this.operation.RootFolder(this.basePath + "\\" + this.root);
……………..
……………..
}
public IActionResult GetImage(FileManagerDirectoryContent args)
{
this.operation.RootFolder(this.basePath + "\\" + this.root);
…………
…………
}
} |
Can I change the path to something which is not wwwroot/Files and so on for example C:\\Downloads?
Thank you!
Hi Julien,
We have reviewed your query and understand that you are looking to set the root folder dynamically in the File Manager component which is located inside the C drive. To achieve this, you can pass the root folder path as a parameter in the “RootFolder” method in the FileManagerController.cs file.
Refer to the below code snippet for further reference.
|
[FileManagerController.cs] { var userDetails = HttpContext.Request.Headers["Authorization"]; if (userDetails[0] == "DynamicUsers") { this.operation.RootFolder("C:\\" + "Folder"); } ....
} |
We have also attached a sample for your reference.
File Manager sample : Attached as zip folder.
Physical File Provider : Attached as zip folder.
Regards,
Suresh.