1.在NuGet中添加包:UEditor.Core
或通过程序包管理控制台:Install-Package UEditor.Core
2.添加服务端统一请求接口
public class UEditorController : Controller { private readonly UEditorService _ueditorService; public UEditorController(UEditorService ueditorService) { this._ueditorService = ueditorService; } [HttpGet, HttpPost] public ContentResult Upload() { var response = _ueditorService.UploadAndGetResponse(HttpContext); return Content(response.Result, response.ContentType); } }
3.在Program.cs中添加
//代码一 builder.Services.AddUEditorService(); //代码二 app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "upload")), RequestPath = "/upload", OnPrepareResponse = ctx => { ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=36000"); } });
4.在项目跟路径下添加两个文件夹
标签:core,UEditor,ueditorService,public,添加,Core,net,response From: https://www.cnblogs.com/fireicesion/p/17432081.html