我已经将ftb.imagegallery.aspx拷入到了根目录下
ImageGalleryPath也已经改成了我新建的文件夹~/ReadingImage/还需要设置哪里才能上传本地图片?

解决方案 »

  1.   

    ?LZ要是想上传本地图片的话直接用FileUpload空间不就好啦
      

  2.   

    http://tech.163.com/05/0317/17/1F2GDJLK00091589.html
      

  3.   

    http://tech.163.com/05/0317/17/1F2GDJLK00091589.html
      

  4.   

    用自带的
     string type;
            if (ddlist.SelectedItem.Value == "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('你还没有选择专栏');window.location.href='User.aspx';", true);
               
                return;
            }
            else
            {
                type = ddlist.SelectedItem.Value;
                ViewState["type"] = type;
                ddlist.Enabled = false;
            }
            Boolean fileOK = true;
            if (fUfile.HasFile)
            {
                if (fileOK)
                {
                    try
                    {
                        string Date = System.DateTime.Now.ToString("yyMMddhhmmss");
                        string subFie = fUfile.FileName.Substring(fUfile.FileName.LastIndexOf("."), 4);
                        string sLocalPath = "../common/wwjeditor/UploadFiles/";
                        string folder = Server.MapPath(sLocalPath)  + type;                    if (!Directory.Exists(folder))
                            Directory.CreateDirectory(folder);
                       
                        string path = folder + "\\" + Date + subFie;                    string fileName = fUfile.FileName;
                        int size = fUfile.PostedFile.ContentLength;
                       // string userName = type;                    Multimedia mul = new Multimedia();
                        mul.Name = fileName;
                        mul.Size = size;
                        mul.Path = "common/wwjeditor/UploadFiles/" + type + "/" + Date + subFie;
                        mul.Series = 1;                    //上传到文件夹
                        sLocalPath = "../common/wwjeditor/UploadFiles/" + type;
                        path = Server.MapPath(sLocalPath) + "\\" + mul.Path.Substring(mul.Path.LastIndexOf("/") + 1);
                        if (!File.Exists(path))
                        {
                            fUfile.SaveAs(path);
                        }
                             if (ViewState["list"] != null)
                        {
                            List<Multimedia> list =(List<Multimedia>) ViewState["list"];
                            mul.Series = list.Count + 1;
                            list.Add(mul);
                            gvAccessory.DataSource = list;
                            gvAccessory.DataBind();
                        }
                        else
                        {
                            List<Multimedia> list = new List<Multimedia>();
                            list.Add(mul);
                            ViewState["list"] = list;
                            gvAccessory.DataSource = list;
                            gvAccessory.DataBind();
                        }                }
                    catch (System.Exception ex)
                    {
                        Response.Write("<script>alert('" + ex.Message + "');</script>");
                        return;
                    }
                }
            }
            else
            {
                Response.Write("<script>alert('上传的文件不符合要求!');</script>");
                return;
            }
      

  5.   

    ResolveUrl("~/ReadingImage/")
    或者Server.MapPath("/ReadingImage/")