简体   繁体   中英

HtmlEditorExtender Image Upload Error in asp.net

I've encountered an error when uploading an image using htmleditorextender.

Below is the error message:

pics.png (image/png) - 616.51 kb (error)

Below is the code that I used in code behind.

protected void HtmlEditorExtender3_ImageUploadComplete(object sender, AjaxFileUploadEventArgs e)
{
    string fullpath = Server.MapPath("~/pictures/") + e.FileName;
    HtmlEditorExtender3.AjaxFileUpload.SaveAs(fullpath);
    e.PostedUrl = Page.ResolveUrl("~/pictures/") + e.FileName;

}

And below is my code in the aspx page.

<asp:HtmlEditorExtender TargetControlID="Textbox1" ID="HtmlEditorExtender3" runat="server" DisplaySourceTab="true" EnableSanitization="False"  OnImageUploadComplete="HtmlEditorExtender3_ImageUploadComplete">
                            <Toolbar>
                                <asp:Undo />
                                <asp:Redo />
                                <asp:Bold />
                                <asp:Italic />
                                <asp:Underline />
                                <asp:InsertUnorderedList />
                                <asp:ForeColorSelector />
                                <asp:JustifyLeft />
                                <asp:JustifyCenter />
                                <asp:JustifyRight />
                                <asp:CreateLink />
                                <asp:InsertImage/>
                            </Toolbar>
                        </asp:HtmlEditorExtender>

Also , I've noticed that it does not also go to the debug part. When I use debugging.

I already solve it guys. What I did is to make some few changes in my web.Config file.

Below are the changes that I made:

1. <system.web>
    <trust level="Full"/>
   </system.web>

2. <remove name="AjaxFileUploadHandler" />
      <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM