Enable image upload for CKEditor at asp.net -
i use ckeditor asp.net c# project. how can enable image upload tab editor. read find articles none of them useful. of them php. want asp.net. thank helping.
i http://www.codedigest.com/articles/aspnet/423_upload_images_and_integrate_with_ckeditor_in_aspnet.aspx letutorial using filebrowserimageuploadurl property our own implementation of file uploader. botton of upload didn't appear , nothing happened. code here:
<head runat="server"> <script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="ckeditor/ckeditor.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { ckeditor.replace('<%=ckeditor1.clientid %>', { filebrowserimageuploadurl: '/upload.ashx' }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <ckeditor:ckeditorcontrol id="ckeditor1" basepath="~/ckeditor/" runat="server" width="600px" height="200px"></ckeditor:ckeditorcontrol> </div> </form> </body> </html>
and ashx file:
<%@ webhandler language="c#" class="upload" %> using system; using system.web; public class upload : ihttphandler { public void processrequest (httpcontext context) { httppostedfile uploads = context.request.files["upload"]; string ckeditorfuncnum = context.request["ckeditorfuncnum"]; string file = system.io.path.getfilename(uploads.filename); uploads.saveas(context.server.mappath(".") + "\\images\\" + file); string url = "/images/" + file; context.response.write("<script>window.parent.ckeditor.tools.callfunction(" + ckeditorfuncnum + ", \"" + url + "\");</script>"); context.response.end(); } public bool isreusable { { return false; } } }
Comments
Post a Comment