Prevent drag/drop for upload / change default message if folder is empty

I'd like to disable the drop/drop upload component of FileManager.  I found articles for the MVC version but not Blazor.  Our app will be download-only...no uploading.  I've customized all the appropriate menus, but I'm not sure how to prevent the drag/drop upload.  

Also - is there way of changing the text if a folder is empty?  I don't mind the 'This folder is empty' message - but I'd like to remove the text that says 'Drag files here to upload'.

3 Replies 1 reply marked as answer

MK Muthukrishnan Kandasamy Syncfusion Team October 1, 2020 10:50 AM UTC

 
Hi Mark, 
 
Thanks for contacting Syncfusion support. 
 
Query 1: I'd like to disable the drop/drop upload component of FileManager. 
 
We can disable the drag and drop upload functionality in Syncfusion Blazor File Manager component. For this requirement, we need to use the JS interop to get the dropArea element of File Manager. Please refer to the below link to know more about interop in Blazor. 
  
 
Please refer to the below code block. 
 
[Index.razor] 
 
<SfFileManager ID="file"> 
    <FileManagerEvents Created="@OnCreated"></FileManagerEvents> 
    <FileManagerAjaxSettings Url="/api/SampleData/FileOperations" 
                             GetImageUrl="/api/SampleData/GetImage" 
                             UploadUrl="/api/SampleData/Upload" 
                             DownloadUrl="/api/SampleData/Download"> 
    </FileManagerAjaxSettings> 
</SfFileManager> 
 
@code{ 
    [Inject] 
    public IJSRuntime JSRuntime { get; set; } 
 
    public async void OnCreated() 
    { 
        await JSRuntime.InvokeAsync<string>("FileManager"); 
    } 
 
} 
 
[_Host.cshmtl] 
 
<script> 
        function FileManager() { 
            var fileObj = document.getElementById("file").ej2_instances[0]; 
            fileObj.uploadObj.dropArea = null;  
        } 
    </script> 
 
 
Query 2: I'd like to remove the text that says 'Drag files here to upload'. 
 
For achieving this requirement in File Manager component, we can simply set the display none for the drop area text content. Please refer to the below code block. 
 
<style> 
    #file .e-empty-inner-content { 
        display: none; 
    } 
</style> 
 
 
We have prepared sample for your convenience, which can be downloaded from the below link. 
 
 
Getting started 
API reference 
Demo 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Muthukrishnan K 


Marked as answer

BR BrianPD March 29, 2022 11:25 PM UTC

For me the property AllowDragAndDrop is not effective at all.  So I tried to implement the above, and I am getting  

"ej2_instances is undefined"


My package references look like:

    <PackageReference Include="Syncfusion.Blazor.Navigations" Version="19.4.0.56" />

    <PackageReference Include="Syncfusion.Blazor.RichTextEditor" Version="19.4.0.56" />

    <PackageReference Include="Syncfusion.Blazor.FileManager" Version="19.4.0.56" />


Any advice?  Did something change in my version (as you can see I'm using separate nugets)?



BR BrianPD replied to Brian Douglas March 30, 2022 11:25 PM UTC


Loader.
Up arrow icon