日期:2014-05-17 浏览次数:20511 次
<CKEditor:CKEditorControl ID="objCKE" runat="server" BasePath="/ckeditor/" Height="600px" FilebrowserImageUploadUrl="/ashx/UpLoad.ashx"></CKEditor:CKEditorControl>代码如上,网页中可以正常显示。
if (context != null)
{
HttpPostedFile hpf = context.Request.Files[0];
string oldname = hpf.FileName;
oldname = oldname.Substring(oldname.LastIndexOf("\\") + "\\".Length);
DateTime temp = DateTime.Now;
string newname = temp.ToString("yyyyMMddHHmmss") + oldname.Substring(oldname.LastIndexOf("."));
string date = temp.ToString("yyyyMMdd");
string serverpath = "/Files/image/" + date + "/";
string path = context.Server.MapPath("/Files/image/" + date + "/");
if (Directory.Exists(path))
{
hpf.SaveAs(path + newname);
}
else
{
Directory.CreateDirectory(path);
hpf.SaveAs(path + newname);
}
}