解决方案 »

  1.   

    可以采用一下方法:
    (1)使用socket、Tcp等协议建立服务,进行流传输,需要在服务器端和客户端开发两套程序(或服务)。
    (2)常用的方式是使用Ftp,就是在服务器端创建ftp服务器,客户端与服务器端进行连接,然后进行传输。希望对你有帮助,有什么问题可以进一步交流。
      

  2.   


    我开始就是用的FTP 服务器端部署的serv-u 但是最近这段时间 老是上传失败 程序直接卡死 调试又不报错 serv-u 日志显示文件没传完用户就注销了.....高了一天了毫无头绪!
      

  3.   

    使用WCF也可以
    http://www.2cto.com/kf/201205/129940.html
      

  4.   

    优先考虑ftp传文件的方式。http://blog.csdn.net/chinacsharper/article/details/9501773
      

  5.   

    FTP方式简单   /// <summary>
            /// 上传文件
            /// </summary>
            /// <param name="filename"></param>
            private string Upload(string filename)
            {
                FileInfo fileInf = new FileInfo(filename);
                if ( !fileInf.Exists ){
                    return filename + " 不存在!\n";
                }
     
                string uri = ftpURI + fileInf.Name;
                FtpWebRequest reqFTP;
                reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
     
                reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
                reqFTP.KeepAlive = false;
                reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
                reqFTP.UseBinary = true;
                reqFTP.UsePassive = false;  //选择主动还是被动模式
                //Entering Passive Mode
                reqFTP.ContentLength = fileInf.Length;
                int buffLength = 2048;
                byte[] buff = new byte[buffLength];
                int contentLen;
                FileStream fs = fileInf.OpenRead();
                try
                {
                    Stream strm = reqFTP.GetRequestStream();
                    contentLen = fs.Read(buff, 0, buffLength);
                    while (contentLen != 0)
                    {
                        strm.Write(buff, 0, contentLen);
                        contentLen = fs.Read(buff, 0, buffLength);
                    }
                    strm.Close();
                    fs.Close();
                }
                catch (Exception ex)
                {
                    return "同步 "+filename+"时连接不上服务器!\n";
                    //Insert_Standard_ErrorLog.Insert("FtpWeb", "Upload Error --> " + ex.Message);
                }
                return "";
            }
     
     
      

  6.   

    最简单的办法是使用标准的 http post/multipart/form-data 方式传送文件。从客户端操作来说,就是写new WebClient().UploadFile(url, file);
    至于服务器端,也很简单,每一个asp.net程序员应该都知道的。
      

  7.   

    使用具有上传功能的Web用户控件
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            string serverPath = Server.MapPath("UpLoad"); //获取服务器端目录绝对路径
            if (!System.IO.Directory.Exists(serverPath)) //如果不存在该目录
            {
                System.IO.Directory.CreateDirectory(serverPath); //创建该目录
            }
            if (FileUpload1.HasFile) //判断是否选择上传的文件
            {
                int filesize = FileUpload1.PostedFile.ContentLength / 1024 / 1024;//获取上传文件的大小
                if (filesize > 8) //如果大于8M
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('只允许上传不大于8兆的文件');", true); //弹出提示信息
                    return;
                }
                else //否则
                {
                    //使用SaveAs方法将上传的文件存储到服务器中
                    FileUpload1.SaveAs(serverPath + "\\" + FileUpload1.FileName);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('上传成功');", true);
                }
            }
            else //如果没有选择文件
            {
                //弹出提示信息
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请选择文件');", true);
                return;
            }
      

  8.   

    个人觉得,还是自己写一个"webservice"接口发布在服务器上,然后客户端通过访问接口形式,将图片上传到服务器,当然啦,webservice其实也是TCP/IP通讯的一种表现形式,楼上各位说的其实也是一样的道理!!
      

  9.   


    请问 我上传时为什么 报错 {System.Net.WebException: 远程服务器返回错误: (550) 文件不可用(例如,未找到文件,无法访问文件)
      

  10.   

    http://www.cnblogs.com/homezzm/p/3612955.html
    还可以使用:http://blog.csdn.net/chinacsharper/article/details/19162047
      

  11.   

    你为什么不在服务器端开通一个ftp服务,给个目录 然后你的程序直接将文件写在这个目录中呢