hi how I know where is the rich text editor images saving i can change that location
hi how I know where is the rich text editor images saving i can change that location
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
RK
Revanth Krishnan
Syncfusion Team
March 26, 2021 05:51 AM UTC
Hi Murali,
Greetings from Syncfusion support.
We have validated your query “How I know where is the Rich Text Editor images saving so that I can change that location”.
By default, when inserting the image it is inserted as blob format, the images can be uploaded to the server using the ‘SaveUrl’ property, and the ‘Path‘ property specifies the location to store the images. You can change the ‘Path’ property to change the location of the image stored.
We have prepared a sample to upload the image to the server and then save the image is the local path to display in the Rich Text Editor for your reference,
Code Snippet:
|
<SfRichTextEditor>
<RichTextEditorImageSettings SaveUrl="api/Image/Save" Path="./Images/"></RichTextEditorImageSettings>
</SfRichTextEditor> |
Server-side Action:
|
[HttpPost("[action]")]
[Route("api/Image/Save")]
public void Save(IList<IFormFile> UploadFiles)
{
try
{
foreach (var file in UploadFiles)
{
if (UploadFiles != null)
{
string filename = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
// Create a new directory, if it does not exists
if (!Directory.Exists(targetPath))
{
Directory.CreateDirectory(targetPath);
}
// Name which is used to save the image
filename = targetPath + $@"\{filename}";
if (!System.IO.File.Exists(filename))
{
// Upload a image, if the same file name does not exist in the directory
using (FileStream fs = System.IO.File.Create(filename))
{
file.CopyTo(fs);
fs.Flush();
}
Response.StatusCode = 200;
}
else
{
Response.StatusCode = 204;
}
}
}
}
catch (Exception e)
{
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = e.Message;
}
} |
Please check the code snippet, sample, and the documentation and let us know if it satisfies your requirement.
Regards,
Revanth
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
MU Muralikrishna
- Mar 25, 2021 07:46 AM UTC
- Mar 26, 2021 05:51 AM UTC