为什么 CKEditor 发送空图像到上传文件?

huangapple go评论52阅读模式
英文:

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应用程序中

存储库:CKEditor-MSQL-DB

英文:

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.

为什么 CKEditor 发送空图像到上传文件?

For more details, you can check the blog and the repo.

Blog: Integrate CK Editor to ASP .NET Core MVC Web Application

Repo: CKEditor-MSQL-DB

huangapple
  • 本文由 发表于 2023年6月6日 02:09:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76408971.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定