if (fileEx == "jpg" || fileEx == "bmp" || fileEx == "gif")
                {
                    
                       System.Drawing.Image image, newimage,newimage2;
                    image = System.Drawing.Image.FromFile(filePath);  // 其他机上传时提示出现异常错误,但是本机没问题 ...  问题出在那里????                    System.Drawing.Image.GetThumbnailImageAbort callb = null;
                    newimage = image.GetThumbnailImage(50, 50, callb, new System.IntPtr());
                    newimage2 = image.GetThumbnailImage(100, 100, callb, new System.IntPtr());
                    newimage.Save(serverpath);
                    newimage2.Save(serverpath2);
                    newimage.Dispose();
                    newimage2.Dispose();
                                       
                                    }
                else
                {
                }

解决方案 »

  1.   

    以下是报错  本机访问不会出错 ................
    -------------------------------------------------------------------------------------------------------说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.IO.FileNotFoundException: D:\Backup\我的文档\My Pictures\pc.jpg源错误: 
    行 106:                    //image = System.Drawing.Image.FromFile(filePath);
    行 107:                    ////System.Drawing.Image image = System.Drawing.Image.FromFile(filePath);
    行 108:                    System.Drawing.Image image = System.Drawing.Image.FromFile(filePath);
    行 109:                    //image = System.Drawing.Image.FromFile(Server.MapPath(filePath));
    行 110:
     堆栈跟踪: 
    [FileNotFoundException: D:\Backup\我的文档\My Pictures\pc.jpg]
       System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) +388162
       System.Drawing.Image.FromFile(String filename) +6
       Users.UploadImage_OnClick(Object sender, EventArgs e) in f:\ASP.NET\txl\Users.aspx.cs:108
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 
      

  2.   

    System.Drawing.Image.FromFile
    只能获取本机文件~
    不能用于上传~
      

  3.   

    System.Drawing.Image.FromFile();
    只能是本地路径!!!
      

  4.   

    根据大家给的意见:
    System.Drawing.Image.FromFile(); 
    只能是本地路径!!!
    没有人给出答案的情况下 ...采取以下方法:就将上传的图片先保存,然后调用处理,处理完后就将原图删除 ...
      

  5.   

    System.Drawing.Image.FromFile();
    只能是本地路径!!!