fckeditor 上传图片时怎么把路径传到数据库里;或者当image文件夹中添加一张图片时立即就往数据库中添加其名称

解决方案 »

  1.   

     //上传图片
        protected void btnImage_Click(object sender, EventArgs e)
        {
            string fullFileName = FileUpImages.PostedFile.FileName;
            string NowTimes = System.DateTime.Now.ToString("yyyyMMddhhssmm");        if (!(fullFileName == ""))
            {
                string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);//图片名字
                string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1);//图片类型
                if (type == "gif" || type == "bmp" || type == "jpg")
                {
                    string newfilename = NowTimes + "." + type;
                    FileUpImages.PostedFile.SaveAs(Server.MapPath("../produces") + "\\" + newfilename);                string iurl = "produces/" + newfilename;
                    labImgUrl.Text = iurl;
                   imgNews.ImageUrl = "../" + iurl;
                }
                else
                {
                    Page.RegisterStartupScript("alert", "<script language=javascript>alert('你选择的图片格式错误!');</script>");
                }
            }
            else
                Page.RegisterStartupScript("alert", "<script language=javascript>alert('请点击浏览按钮,选择您要上传的.gif或.bmp或.jpg图片!!');</script>");
        }这是我的上传图片的 代码 你参考下吧
      

  2.   

    不知道你想干什么,你配置好之后,FCKEditor会自动把图片上传到你指定的文件夹,然后你把html保存就行了。
    没必要单独处理
      

  3.   

    string  fckStr  =  FCKeditor1.Value;
                    MatchCollection  matchs  =  Regex.Matches(fckStr,  @ " <img\s[^> ]*src=([ " " ']*)(? <src> [^ ' " "]*)\1[^> ]*> ",  RegexOptions.IgnoreCase);
                    foreach  (Match  m  in  matchs)  {
                            Response.Write(m.Groups[ "src "].Value+ " <br> ");
                    }
      

  4.   

    用正则取到fck里所有的图片集合。然后将图片路径保存在数据库中
      

  5.   

    都是直接指定用的,fckeditor上传图片的路径还真没忘数据库里保存过
      

  6.   

    struts2 action 里怎么取出呀?