Set header for image upload in Rich Text Editor.
Hello.
I was wondering if it is possible to set the header content before the editor is calling the api to upload the image. My asp net core web api is using identity and i would therefore like to secure my image upload controller. However the cookie is not send with the upload request from the rich text editor.
JBN
SIGN IN To post a reply.
3 Replies
IS
Indrajith Srinivasan
Syncfusion Team
April 13, 2020 03:18 PM UTC
Hi Jakob,
Greetings from Syncfusion support,
We have validated the reported query. Yes, you can set the headers content in the OnImageSelected event in Rich Text Editor before uploading. Can you please check the below code block for reference.
Code block:
Greetings from Syncfusion support,
We have validated the reported query. Yes, you can set the headers content in the OnImageSelected event in Rich Text Editor before uploading. Can you please check the below code block for reference.
Code block:
|
@using Syncfusion.Blazor.RichTextEditor
@using Newtonsoft.Json;
<SfRichTextEditor Value="@Content">
<RichTextEditorEvents OnImageSelected="@onselected"></RichTextEditorEvents>
<RichTextEditorImageSettings SaveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save"></RichTextEditorImageSettings>
</SfRichTextEditor>
@code {
public string Content { get; set; } = "<p>RichTextEditor Content";
private void onselected(object args)
{
Syncfusion.Blazor.Inputs.SelectedEventArgs Headers = JsonConvert.DeserializeObject<Syncfusion.Blazor.Inputs.SelectedEventArgs>(JsonConvert.SerializeObject(args));
Headers.CustomFormData = new List<customHeaders> { new customHeaders() { content = "syncfusion RichTextEditor" } };
}
public class customHeaders
{
public string content{ get; set; }
}
} |
API Link: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.RichTextEditorModel.html#Syncfusion_Blazor_RichTextEditor_RichTextEditorModel_ImageSelected
Please let us know if the solution helps,
Regards,
Please let us know if the solution helps,
Regards,
Indrajith
AI
Alessio Iafrate
June 1, 2020 05:49 PM UTC
This solution not works for me, i don't see the custom headers in request
IS
Indrajith Srinivasan
Syncfusion Team
June 2, 2020 08:24 AM UTC
Hi Alessio,
Good day to you,
We have already considered “Custom headers not added for the image file uploaded in Rich Text Editor” as a bug from our end and logged the report for the same and the fix will be included with our 2020 Volume 2 beta Release.
You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/13576/
You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/13576/
Regards,
Indrajith
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
UN Unknown
- Apr 12, 2020 12:17 PM UTC
- Jun 2, 2020 08:24 AM UTC