uriString="http://localhost/c/Upload/2_28-3-326-332_200208101436.jpg";

解决方案 »

  1.   

    string fileName ="C://Documents and Settings//Administrator//My Documents//My Pictures//2_28-3-326-332_200208101436.jpg";
      

  2.   

    huhu.
    string fileName =@"C:\Documents and Settings\Administrator\My Documents\My Pictures\2_28-3-326-332_200208101436.jpg";or
    string fileName ="C:\\Documents and Settings\\Administrator\\My Documents\\My Pictures\\2_28-3-326-332_200208101436.jpg";
      

  3.   

    其实你用C:/2_28-3-326-332_200208101436.jpg
    应该就没问题""有空格Documents and Settings
    url解析的结果是DocumentsandSettings
    而这个目录是不存在的!
      

  4.   

    完整解决方法:public class UpLoad:System.Web.UI.Page
    {

    /// <summary>
    /// 上传文件到服务器目录下的uploadfile里,并返回一个保存后的文件。
    /// </summary>
    /// <param name="upload"></param>
    /// <returns></returns>

    public string FileUpLoad(System.Web.UI.HtmlControls.HtmlInputFile upload,string pa)
    {
    // try
    // {
    string filename=upload.PostedFile.FileName;
    int i= filename.LastIndexOf(".");
    //取得文件扩展名
    string newext =filename.Substring(i);
    //这里我自动根据日期和文件大小不同为文件命名,确保文件名不重复
    DateTime now = DateTime.Now; 
    string newname=now.ToShortDateString().Replace("-","")+now.ToShortTimeString().Replace(":","")+upload.PostedFile.ContentLength.ToString(); 
    upload.PostedFile.SaveAs(Server.MapPath("uploadfile\\")+newname+newext);
    return pa+"uploadfile\\"+newname+newext; //返回文件及路径名
    // }
    // catch(System.Exception err)
    // {
    // throw new Exception(err.Message);
    // }
    }  
    }
      

  5.   

    你使用WebClient来上传文件,你要搞清楚一件事。
    那就是你的程序是在服务器上运行的。
    你要上传的并不是你本地的文件,而是你服务器上的。服务器上的文件对你本地文件没有操作权限。
      

  6.   

    那webclient拿来干什么?没有用了嘛,
    这可是webclient,客户端!,请问一下webclient有什么用?
      

  7.   

    用WebClient下载没任何问题。所以,我想,在服务器方应该有个东西来接收数据并保存到文件。这个东西是什么呢?