Good Day..... Here is a good one for you guys. I developped a knowledge base in Asp.net/vb.net for our Department IT Service Desk. Now I am working on the Wiki part of it, I basically made a webpage editor with a Htmleditorexternder textbox. Everything thing is working fine except for the Insert Image option. I cannot get the Image to upload to the textbox. So going through permissions and stuff and following the points in debug I seen what is going on. I soon as I add the file and click upload it goes to 100% Then I keep debugging and look into my Temp folder the file is there. Hit Play button again the file is deleted from temp and added into my ~/kb/images/ folder. Hit play again it delete it from the Images folder and then I get this error message:
Could not find the file 'C:\Users\username\AppData\Local\Temp\_AjaxFileUpload\Thewholenumberofthefolder\file.png, I get this error @ the line:
HtmlEditorExtender1.AjaxFileUpload.SaveAs(fullpath.ToString).
Did alot of research online and been adding the httphandler/handlers for ajaxfileupload to the web.config. I do have the latest version of AjaxControl Toolkit from july 2013 installed. Also the permissions are fine as you can see through the process the file is being put into the folders and deleted & I have the App Pool Account and IIS Users account with access to the files and folders. I did also add the everyone group just for the sake and it did the same thing. So this is for the debug part.
In live it just says (error) no error it wont even go to 100% like in debug.
So here is my code
Aspx Page:
<asp:ToolkitScriptManagerID="ToolkitScriptManager1"runat="server">
</asp:ToolkitScriptManager>
<asp:TextBoxID="tbnotes"runat="server"Columns="60"Height="651px"Rows="8"TextMode="MultiLine"Width="734px"/>
<asp:HtmlEditorExtenderID="HtmlEditorExtender1"runat="server" EnableSanitization="false"TargetControlID="tbnotes"DisplaySourceTab="false"OnImageUploadComplete="HtmlEditorExtender1_ImageUploadComplete">
<Toolbar>
<asp:InsertImage/>
</Toolbar>
</asp:HtmlEditorExtender>
Here is my Vb File Code:
ProtectedSub HtmlEditorExtender1_ImageUploadComplete(sender AsObject, e As AjaxControlToolkit.AjaxFileUploadEventArgs)Handles HtmlEditorExtender1.ImageUploadComplete
Dim fullpath AsString
fullpath = Server.MapPath("~/kb/images/")+ e.FileName
Dim ajaxFileUpload = DirectCast(sender,AjaxFileUpload)
' HtmlEditorExtender1.AjaxFileUpload.SaveAs(Server.MapPath("~/kb/images/") + e.FileName)
tbnotes.Text += String.Format("<img src=?preview="& fullpath &" Width=200px Heigh=200px>")
' tbnotes.Text = e.PostedUrl("<img src =" & fullpath & " Width=200px Heigh=200px>")
e.PostedUrl = Page.ResolveUrl("<img src =?preview="& fullpath &" Width=200px Heigh=200px>"+ e.FileName &Convert.ToString(e.FileName))
EndSub
Any help would be really appreciated.
Cheers,
Pierre