Thank you so much your quick reply.
Rich Text Editor's contents save on MS-SQL as TEXT field.
I cannot save image to database TEXT field. so saved html contents ONLY to TEXT field and saved image on Azure Blob.
Save image function is working based on your advise.
But, I read saved contents for edit and delete existing image on editor.
I need to remove uploaded image of Azure Blob also.
I used "OnImageRemoving" event to remove image that saved on Azure Blob. but cannot remove image.
Which event should I use to remove image ?
<SfRichTextEditor CssClass="tanweb-rte"
EditorMode="EditorMode.HTML"
@bind-Value="@selectedObject.Notes">
<RichTextEditorToolbarSettings Items="@Toolbar"></RichTextEditorToolbarSettings>
<RichTextEditorImageSettings SaveUrl="api/RtfImage/SaveImage" Path="https://tanstorageserver.blob.core.windows.net/tan-public/student/rtfeditor/">
</RichTextEditorImageSettings>
<RichTextEditorEvents OnImageRemoving="OnRemoveImage"></RichTextEditorEvents>
</SfRichTextEditor>
[HttpPost]
[Route("SaveImage")]
public async Task SaveImage(IList<IFormFile> uploadFiles)
{
try
{
foreach (var file in uploadFiles)
{
const string containerName = "tan-public";
const string connectionString = "DefaultEndpointsProtocol=https;AccountName=tanstorageserver;AccountKey=*****;EndpointSuffix=core.windows.net";
var container = new BlobContainerClient(connectionString, containerName);
await container.CreateIfNotExistsAsync();
BlobClient blob = container.GetBlobClient("student/rtfeditor/" + file.FileName);
var stream = file.OpenReadStream();
await blob.UploadAsync(stream);
}
}
catch(Exception ex)
{
Response.Clear();
Response.StatusCode = 204;
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "File failed to upload";
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = ex.Message;
}
}