上传图片时:
string postedFileName=filePic1.PostedFile.FileName;
string picURL=newsTime+postedFileName.Substring(postedFileName.LastIndexOf("."));
//BITMAP
Bitmap picOld = new Bitmap(filePic1.PostedFile.FileName);//这里抱错
Bitmap picNew;
picNew = new Bitmap(picOld, 260, 190);
Response.Clear();
picNew.Save(Server.MapPath("picNews/"+picURL), ImageFormat.Jpeg);
picNew.Dispose();
而且在我自己的机器(服务器)上是没有错误的,在别人的机器上就出错:[ArgumentException: 使用了无效参数。]
   System.Drawing.Bitmap..ctor(String filename)
   student.modifyPicNews.ibSubmit_Click(Object sender, ImageClickEventArgs e) in e:\iisweb\student\modifypicnews.aspx.cs:83
   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain() 

解决方案 »

  1.   

    看看filePic1.PostedFile.FileName的内容
      

  2.   

    我设置了断点,是有的,没问题  且在我自己的机器上一切正常 在其他人的机上就出错。郁闷ING
      

  3.   

    我的IIS目录是NTFS格式的 而且我设置好了everyone的写入权限
      

  4.   

    Bitmap picOld = new Bitmap(filePic1.PostedFile.FileName);PostedFile.FileName获取的是客户端机器上的文件路径及名称
    你的服务器上没有该文件
      

  5.   

    在你机器上浏览一个文件,PostedFile.FileName获得的地址 在你机器上是有的,而别人机器上的路径服务器上不一定有
    所以你应先SaveAs到服务器上 然后 用Bitmap(string)这个构造函数