我的程序中上传的图片是存放到了wwwroot目录下了,而不是在我e盘程序目录下://生成上传地址
string imageSavePath = Server.MapPath("/") + ConfigurationSettings.AppSettings["ImageSavePath"].ToString() + bVO.BlogID + "\\" + categoryID.SelectedValue + "\\";
这儿要如何改动?

解决方案 »

  1.   

    什么都不要改动,你只要配置ImageSavePath这个节点就可以了。
    <Property key="ImageSavePath" default="C:\Inetpub\wwwroot" />
      

  2.   

    <Property key="ImageSavePath" default="C:\Inetpub\wwwroot\" />
    忘了加个“\“
      

  3.   

    我是不想让图片放到wwwroot下面,而是要放到我的e盘的程序目录images下!
    在web.config中ImageSavePath的values值应该怎么写呢?
      

  4.   

    在web.config文件中我是这样设的
     <appSettings>
    <add key="sqlconnection" value="server=.;database=MyBlog;uid=sa;pwd=;"/>
        <add key="ImageWebPath" value="/Images/Pictures/"/>

    <add key="ImageSavePath"  value="\\Images\\Pictures\\"/>
    <add key="ImageThumbWidth" value="120"/>
    <add key="ImageResizeWidth" value="640" />
      </appSettings>这样子的结果是把图片保存在wwwroot下面的,我想把图片放到我e盘程序的目录下,而不要放在wwwroot下面,不知道乍改?
      

  5.   

    那要在代码里产生绝对路径才能达到你想要的效果 “我想把图片放到我e盘程序的目录下,而不要放在wwwroot下面"
     public void saveImage(HtmlInputFile file, string path, string filePath)
        {
            string filename, fileExtension;
            filename = System.IO.Path.GetFileName(file.PostedFile.FileName);
            if (filename != "")
            {            fileExtension = System.IO.Path.GetExtension(filename);
                fileExtension = fileExtension.ToLower();       //转换为小写            //判断图片类型
                if (fileExtension == ".gif" || fileExtension == ".jpg" || fileExtension == ".png")
                {
                    filename = random() + fileExtension;
                    file.PostedFile.SaveAs(Server.MapPath("UploadFiles") + "\\" + path + "\\" + filename);
                                   RegisterClientScriptBlock("infi", "<script language=javascript>alert(' 图片保存成功! ');</script>");                if (filePath == "fun_img")
                    {
                        fun_img = path + "/" + filename;
                    }
                    else
                    {
                        fun_vido = path + "/" + filename;
                    }
                }
                else
                {
                    RegisterClientScriptBlock("infi", "<script language=javascript>alert(' 图片类型不符合要求 ');</script>");
                    return;
                }        }
        }
      

  6.   

    string imageSavePath = Server.MapPath(/images/);
    绝对OK,用去吧,
    便是如果是用了虚拟目录的话就得加个目当别名了,自己看着办吧