英文:
why ckeditor send null image to upload file
问题
以下是您提供的内容的翻译:
"以下代码是我编写的,用于在ASP Core 5中使用CKEditor,但当我上传图片时,它将空文件发送到控制器中的UploadFile函数。为什么?
我希望您可以帮助我,因为我真的需要它。
控制器:
[HttpPost]
[AllowAnonymous]
public IActionResult UploadFile(IFormFile File)
{return Json(_postService.UploadFile(File));
}
视图:
CKEDITOR.replace('Description', {filebrowserImageBrowseUrl: 'Uploads', filebrowserImageUploadUrl: '/Blog/UploadFile', }
"
英文:
The following codes are the codes I wrote to use the ckeditor in asp core5 ,but When I upload the image, it sends null file to UploadFile function in controlller
Why?
I hope you can help me because I really need it
>
> Controller:
> [HttpPost]
> [AllowAnonymous]
> public IActionResult UploadFile(IFormFile File)
> {
>
> return Json(_postService.UploadFile(File));
>
> }
>
> view:
> <scripts>
> CKEDITOR.replace('Description', {
>
> filebrowserImageBrowseUrl: 'Uploads',
>
> filebrowserImageUploadUrl: '/Blog/UploadFile',
>
> }
> </scripts>
>
答案1
得分: 0
此代码用于选择本地图像文件而不使用ckeditor。在使用ckeditor4时,我们可以提交模型中的所有属性。
有关更多详细信息,您可以查看博客和存储库。
博客:将CK Editor集成到ASP.NET Core MVC Web应用程序中
英文:
This public IActionResult UploadFile(IFormFile File)
code used for choosing local image file without using ckeditor. When using ckeditor4, we can submit all the properities in model.
For more details, you can check the blog and the repo.
Blog: Integrate CK Editor to ASP .NET Core MVC Web Application
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论