Question

I added Htmleditorextender to my webapplication but i am not able to set path of where on the server the image will be uploaded i dont know how to set that path and configure image uploader, now when i try to upload and add image to editor in IE-10 it stops working and freezes showing no progress in upload and in firefox it finishes uploading to 100% but image is not uploaded to debug server and not shown in editor how can i configure this image facility. please help my project is pending.

this is my code.

protected void ajaxFileUpload_OnUploadComplete(object sender,  AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
        hee.AjaxFileUpload.SaveAs(@"~\Container\temp\" + e.FileName);
        e.PostedUrl = Page.ResolveUrl(@"~\Container\temp\" + e.FileName);
    }

aspx code:

<asp:TextBox
    ID="txtComments"
    TextMode="MultiLine"
    Columns="100"
    Rows="40"
    Runat="server" />
<ajaxToolkit:HtmlEditorExtender ID="hee" OnImageUploadComplete="ajaxFileUpload_OnUploadComplete" TargetControlID="txtComments" DisplaySourceTab="true" EnableSanitization="true" Runat="server" >
    <Toolbar> 
            <ajaxToolkit:Undo />
            <ajaxToolkit:Redo />
            <ajaxToolkit:Bold />
            <ajaxToolkit:Italic />
            <ajaxToolkit:Underline />
            <ajaxToolkit:StrikeThrough />
            <ajaxToolkit:Subscript />
            <ajaxToolkit:Superscript />
            <ajaxToolkit:JustifyLeft />
            <ajaxToolkit:JustifyCenter />
            <ajaxToolkit:JustifyRight />
            <ajaxToolkit:JustifyFull />
            <ajaxToolkit:InsertOrderedList />
            <ajaxToolkit:InsertUnorderedList />
            <ajaxToolkit:CreateLink />
            <ajaxToolkit:UnLink />
            <ajaxToolkit:RemoveFormat />
            <ajaxToolkit:SelectAll />
            <ajaxToolkit:UnSelect />
            <ajaxToolkit:Delete />
            <ajaxToolkit:Cut />
            <ajaxToolkit:Copy />
            <ajaxToolkit:Paste />
            <ajaxToolkit:BackgroundColorSelector />
            <ajaxToolkit:ForeColorSelector />
            <ajaxToolkit:FontNameSelector />
            <ajaxToolkit:FontSizeSelector />
            <ajaxToolkit:Indent />
            <ajaxToolkit:Outdent />
            <ajaxToolkit:InsertHorizontalRule />
            <ajaxToolkit:HorizontalSeparator />
            <ajaxToolkit:InsertImage />
        </Toolbar>
    </ajaxToolkit:HtmlEditorExtender>
Was it helpful?

Solution

It seems that you are not using the double backslash for the path:

protected void ajaxFileUpload_OnUploadComplete(object sender,  AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
    hee.AjaxFileUpload.SaveAs(@"~\\Container\\temp\\" + e.FileName);
    e.PostedUrl = Page.ResolveUrl(@"~\\Container\\temp\\" + e.FileName);
}

I hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top