SFRichTextEditor can't change image name/id when uploading

Trying to intercept the image prior to uploading to rename with guid to prevent same name clashes. Despite successfully modifying the filedata using BeforeUploadImage and/or OnImageSelected neither seem to propgate through to the POST request. 

I did note that OnImageSelected args also contained a ModifiedFilesData property and flag but setting both of these actually prevented the UI popup upload button from being clickable.

I'm sure there is a way to do this but it escapes me at the moment - any pointers would be helpful. Note we are on an older version of syncfusion 22.2.9 but don't have the opportunity to upgrade immediately. 


1 Reply

VY Vinothkumar Yuvaraj Syncfusion Team October 28, 2024 09:26 AM UTC

Hi Oliver Bowen,


We have validated your reported query, and you can use the OnImageSelected event to modify the file name and set IsModified to true before posting to the server. Please see the following code and the attached sample for your reference:




    <SfRichTextEditor>

    <RichTextEditorImageSettingsSaveUrl="https://localhost:7021/api/RichTextEditor/SaveFile" Path="https://localhost:7021/images/" />

    <RichTextEditorEvents OnImageSelected="@OnImageSelectedHandler"/>

    </SfRichTextEditor>

 

@code {

    public void OnImageSelectedHandler(SelectedEventArgs args)

    {

      args.IsModified = true;

      args.FilesData[0].Name = "Testing3.png";

    }

}



If you're still facing an error, could you please share the following information that will help us replicate the issue on our end?

  • The Syncfusion package version you are using in your application
  • The full-page Rich Text Editor code snippet
  • A video demonstration of your issue


Regards,
Vinothkumar


Attachment: BlazorApp1_dcce9176.zip


Loader.
Up arrow icon