Hi,
I'm trying to rename added images in the rich text editor. I have followed the tutorial, but it seems that for blazor wasm the headers are filtered out. I can see that the server returns the added headers, but they're not available in the ImageSuccessEventArgs.
I have tested the same with blazor server and there it seems to work fine.
I looked as this thread also, but it doesn't specify if it's server or wasm.
https://www.syncfusion.com/forums/157797/rename-image-on-upload-in-richtexteditor
private void onSuccess(ImageSuccessEventArgs args)
{
var headers = args.Response.Headers.ToString();
header = headers.Split("name: ");
header = header[1].Split("\r");
args.File.Name = header[0];
}
|
Hi Indrajith,
This is exactly the example i've run. I can see the headers being returned, but they don't exist in the ImageSuccessEventArgs:
When I run the exact same code from a blazor server side application it does work. So it seems they are being filtered out somewhere in the code? A similar issue (for javascript) existed earlier:
https://www.syncfusion.com/forums/150534/rename-images-before-inserting-it-in-richtexteditor
Best regards,
Marcel
Hi Indrajith,
First of all, thank you for the fast and accurate replies!
I've ran the sample you supplied and that is working fine, I receive all headers on the client side.
The difference between this and my setup is, is that my API is running on a different address, so I have to setup some basic CORS settings and it seems I have missed to set the correct Access Control Expose Headers.
The problem was with my CORS setup and not with the syncfusion controls.
Adding:
.WithExposedHeaders("name"); to my Cors policy on the serverside fixed the problem.
Thank you for your help and my apologies for your invested time.
Best regards,
- Marcel