Creating custom root folder based on RootAliasName

I am trying to set root file folder for based on the RootAliasName of the SfFileManager component. I have the following code:

<SfFileManager TValue="FileManagerDirectoryContent" RootAliasName="@rootfolder">
    <FileManagerAjaxSettings Url="/api/FileManager/FileOperations"
                             DownloadUrl="/api/FileManager/Download"
                             UploadUrl="/api/FileManager/Upload"
                             GetImageUrl="/api/FileManager/GetImage">
        
    </FileManagerAjaxSettings>
</SfFileManager>

On the controller side, I have this code (Syncfusion default code):


public FileManagerController(IHostingEnvironment hostingEnvironment)
        {
            
            this.basePath = hostingEnvironment.ContentRootPath;
            this.operation = new PhysicalFileProvider();
            this.operation.RootFolder(this.basePath + "\\wwwroot\\Files"); // Data\\Files denotes in which files and folders are available.
        }

My question is where do I set the RootAliasName on the controller side? 


3 Replies 1 reply marked as answer

MK Muthukrishnan Kandasamy Syncfusion Team January 5, 2021 02:27 PM UTC

 
Hi Amjad, 
 
Thanks for contacting Syncfusion support. 
 
We have validated your requirement in Syncfusion Blazor File Manager component. For achieving your requirement, we need to pass the additional data from client to server side. We have considered this requirement as feature in Blazor File Manager component. The support for this feature will be included in the upcoming weekly release which is expected to be released by the mid of January 2021.  
 
You can track the status through the below portal link. 
 
 
We appreciate your patience. 
 
Regards, 
Muthukrishnan K 




AK Amjad Khan January 24, 2021 05:07 AM UTC

Hello Support,

Has this been released yet?

Regards,
Amjad.


KR Keerthana Rajendran Syncfusion Team January 25, 2021 07:10 AM UTC

Hi Amjad,  
 
Thanks for your patience.  
  
We are glad to announce that our patch release (V18.4.34) is rolled out successfully. In this release, we have included feature for “passing additional data in onSend event for FileManager component”. To access this feature, we suggest you to update the package to the latest version (V18.4.34).  
  
To achieve your requirement, you need to add the data with CustomData argument in OnSend event.  
  
@using Syncfusion.Blazor.FileManager;  
@using Newtonsoft.Json    
<div class="control-section">  
    <SfFileManager TValue="FileManagerDirectoryContent">  
      <FileManagerEvents TValue="FileManagerDirectoryContent" OnSend="send"></FileManagerEvents>  
        <FileManagerAjaxSettings Url="/api/Home/FileOperations"  
                                 UploadUrl="/api/Home/Upload"  
                                 DownloadUrl="/api/Home/Download"  
                                 GetImageUrl="/api/Home/GetImage">  
        </FileManagerAjaxSettings>  
    </SfFileManager>  
</div>  
@code{  
    public void send(Syncfusion.Blazor.FileManager.BeforeSendEventArgs args)  
    {  
      Dictionary<string, object> data = new Dictionary<string, object>();  
      data.Add("FilePath", "Syncfusion");  
      args.CustomData = data;  
    }  
}  
  
Controller:  
  
  public class FileManagerDirectoryContent1  
  {  
    public Dictionary<string, object> CustomData { get; set; }  
    public bool HasChild { get; set; }  
    public DateTime DateCreated { get; set; }  
    public DateTime DateModified { get; set; }  
    public string PreviousName { get; set; }  
  }  
[Route("FileOperations")]  
    public object FileOperations([FromBody] FileManagerDirectoryContent1 args)  
    {  
      string filepath = args.CustomData["FilePath"].ToString();     
}  
  
  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.  
  
 
Regards, 
Keerthana.   


Marked as answer
Loader.
Up arrow icon