Update Buttons with HTML

Please provide an example of passing html to the SfUploader.Buttons property.


1 Reply 1 reply marked as answer

SN Sevvandhi Nagulan Syncfusion Team July 6, 2020 06:10 AM UTC

Hi Haywood,  
  
Greeting from Syncfusion support.  
  
For customize the action buttons of the Blazor file upload component, you can use the button property as like below code snippet.  
  
  
[Index.razor 
  
<SfUploader AutoUpload="false" Buttons="@browseBtn"> 
    <UploaderEvents ValueChange="OnChange" OnRemove="onRemove"></UploaderEvents> 
</SfUploader> 
 
@code { 
    private UploaderButtonsProps browseBtn = new UploaderButtonsProps() { Browse = "update audio", Clear = "Clear All", Upload = "Upload All" }; 
    private void OnChange(UploadChangeEventArgs args) 
    { 
        foreach (var file in args.Files) 
        { 
            var path = @"path" + file.FileInfo.Name; 
            FileStream filestream = new FileStream(path, FileMode.Create, FileAccess.Write); 
            file.Stream.WriteTo(filestream); 
            filestream.Close(); 
            file.Stream.Close(); 
        } 
    } 
    private void onRemove(RemovingEventArgs args) 
    { 
        foreach (var removeFile in args.FilesData) 
        { 
            if (File.Exists(Path.Combine(@"rootPath", removeFile.Name))) 
            { 
                File.Delete(Path.Combine(@"rootPath", removeFile.Name)); 
            } 
        } 
    } 
}  
  
   
Kindly check with the above sample meets your requirement. Please get back us, if you need further assistances.  
  
Regards,  
Sevvandhi N 


Marked as answer
Loader.
Up arrow icon