这是出问题的地方:webFilePath = Server.MapPath("~/" + strFName + "/" + fileName); // 服务器端文件路径strFName 是通过获取图片名创建的以图片名命名的文件夹,fileName是图片名字(包括扩展名)肯定是这个路径写的不对,在vs里运行就没错,能够成功上传,但在iis里运行就歇菜了,求啊解啊~~~~~~

解决方案 »

  1.   


    试试:webFilePath = Server.MapPath("../" + strFName + "/" + fileName);
    你用~是定位到虚拟目录的根目录了。。
      

  2.   

    1,你要学会调试,打印出 webFilePath 是什么路径,真的存在吗
    2,检查路径是否有匿名帐号可以修改的权限,注意你必须明白,iis下的匿名帐号是什么
      

  3.   

    webFilePath = Server.MapPath("~/" + strFName + "/" + fileName); // 服务器端文件路径
    我把这句改成: webFilePath =  strFName + "/" + fileName; // 服务器端文件路径
    在iis上运行就不报错了,成功上传了。。
      

  4.   

    你应该先
    webFilePath = Server.MapPath("~/" + strFName + "/")
    if(!Directory.Exists(webFilePath )) 
     Directory.CreateDirectory(webFilePath );webFilePath += fileName;
      

  5.   

    应该是相应路径下的文件夹权限不足设置为 everyone