AJAX HTML编辑器扩展程序上传图像显示为空白 [英] AJAX Html Editor Extender upload image appearing blank

查看:113
本文介绍了AJAX HTML编辑器扩展程序上传图像显示为空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用AJAX 4(最新版本),我一直在与html编辑器扩展程序一起尝试上传带有文本的图像,我已经上传了Image,但是它显示为空白,并且在查看源代码时,图像的源代码是也为空白(下图)如何解决此上传我选择的图像?

Using AJAX 4 (latest version) I have been working with the html editor extender trying to upload images with text, I have got the Image to upload however it appears blank and when looking at the source, the source of the image is also blank (image below) how do I resolve this upload my selected image?

推荐答案

在HtmlEditorExtender中包含ImageUploadComplete事件的事件处理程序。

Include in HtmlEditorExtender an event handler for the ImageUploadComplete event.

<ajaxToolkit:HtmlEditorExtender
    OnImageUploadComplete="MyHtmlEditorExtender_ImageUploadComplete"
    ...

在ImageUploadComplete事件处理程序中,您需要做两件事:

Within the ImageUploadComplete event handler, you need to do two things:

1)保存上传的图像

2)提供保存图像的URL,以便可以在HtmlEditorExtender中显示图像

1) Save the uploaded image
2) Provide the URL to the saved image so the image can be displayed within the HtmlEditorExtender

protected void MyHtmlEditorExtender_ImageUploadComplete(
     object sender, AjaxFileUploadEventArgs e)
{
     // Generate file path
     string filePath = "~/Images/" + e.FileName;

     // Save uploaded file to the file system
     var ajaxFileUpload = (AjaxFileUpload)sender;
     ajaxFileUpload.SaveAs(MapPath(filePath));

     // Update client with saved image path
     e.PostedUrl = Page.ResolveUrl(filePath);
} 

请确保已选中
http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/HTMLEditorExtender/HTMLEditorExtender.aspx b http://stephenwalther.com/archive/ 2012/05/01 / ajax-control-toolkit-may-2012-release

这篇关于AJAX HTML编辑器扩展程序上传图像显示为空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆