Replace the button at the file upload with an icon

How can I replace the button at the file upload with a folder icon and replace the sentence "Or drop files here" or remove it completely ?

Sycfusion_File_upload.PNG


4 Replies 1 reply marked as answer

UD UdhayaKumar Duraisamy Syncfusion Team August 10, 2022 04:43 PM UTC

Hi Artur,


We are validating the requirement. We will update the further details in two business days (12th August 2022).


Regards,

Udhaya Kumar D



UD UdhayaKumar Duraisamy Syncfusion Team August 12, 2022 03:01 PM UTC

Hi Artur,


We can replace the browse button with icons using Created event, JSInterop, and CSS. Please refer to the below code snippet and documentation for more details.


[Index.razor]

@page "/"

 

@using Syncfusion.Blazor.Inputs

@inject IJSRuntime JSRuntime

<SfUploader>

    <UploaderEvents Created="@CreatedHandler"></UploaderEvents>

</SfUploader>

 

@code {

    private async Task CreatedHandler()

    {

        await JSRuntime.InvokeAsync<object>("Icons");

    }

}

 

<style>

    .e-icons

    {

        color:black;

    }

 

    .e-upload .e-file-select-wrap .e-btn

    {

        border: none;

        background-color: transparent;

        box-shadow: none;

    }

</style>


[_Layout.cshtml]

<script>

        function Icons()

        {

            document.getElementsByClassName('e-css e-btn e-upload-browse-btn')[0].innerHTML = "<i class='e-icons e-upload-1'></i>";

document.getElementsByClassName('e-file-drop')[0].innerHTML = 'YOU CAN REPLACE THE SENTANCE';

        }

    </script>


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorUploadIICON2147000389


Regards,

Udhaya Kumar D


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Marked as answer

AZ Artur Zigel August 19, 2022 10:10 AM UTC

Thank you for the great support



UD UdhayaKumar Duraisamy Syncfusion Team August 19, 2022 12:23 PM UTC

Hi Artur,


We are glad that your requirement has been fulfilled on your end. We are always happy to assist you.


Regards,

Udhaya Kumar D


Loader.
Up arrow icon