HTML Editor not showing upload images

Hi,
Uploading image not showing on HTML editor. Any reason why not showing the image ? Image is in Image folder but not showing. Please see my controller code below (asp.net core blazor app) . Thanks !

[HttpPost("upload/image")]
        public IActionResult Image(IFormFile file)
        {
            try
            {                
                var extension = "." + file.FileName.Split('.')[file.FileName.Split('.').Length - 1];
                var uploadPath = Path.Combine(Directory.GetCurrentDirectory(), "Images/");
                var fileName = $"{file.FileName}___{Guid.NewGuid()}{extension}";                
                var filePath = Path.Combine(uploadPath, fileName);
                using (var stream = new FileStream(filePath, FileMode.Create))
                {                    
                    file.CopyTo(stream);                    
                    var url = Url.Content($"~/Images/{fileName}");
                    return Ok(new { Url = url });
                }
            }
            catch (Exception ex)
            {
                return StatusCode(500, ex.Message);
            }
        }
<RadzenHtmlEditor Style="height: 450px; margin-bottom: 1rem;"
                          @bind-Value="@Value"
                          UploadUrl="upload/image"
                          Disabled="@IsSaving"
                          Change="@(OnChange)" />

Probably that directory is not configured to serve over HTTP. By default files in the wwwroot directory are served. If you want additional directories to be served you need to configure your ASP.NET application accordingly.

1 Like

Thanks for your prompt reply. My folder structure is "wwwroot/Images" , any suggestion please for asp.net core application? Thanks !

This probably isn't going to resolve to wwwrot/Images - there is a chance those images are saved elsewhere. Check our online demos for a working implementation.

Thanks , issue is resoled . I have added this lines of code


app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images")),
                RequestPath = "/Images"
            });