我尝试根据以下页面在redactor中上传图片: https://imperavi.com/redactor/docs/how-to/upload-images/
图像文件正在上传很好,但是它没有返回到图像的正确路径,因此在编辑器中我只得到以下随机数据图像"在我的HTML img中:
<img data-image="3bmpsdp1fgff">
以下是我的控制器中的代码:
public ActionResult ImageUpload()
{
string filePath = "/myPath/";
HttpPostedFileBase file = null;
if (Request.Files.Count > 0)
{
file = Request.Files[0];
}
if (file != null && file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Server.MapPath(filePath + fileName);
file.SaveAs(path);
}
return Json(new { filelink = filePath + file.FileName });
}
提前致谢。