需要client以及server端编程做客户端和服务端
建立连接后,将文件通过序列化转城memorystream/networkstream的二进制流传输,在服务端进行反序列化 *** 作
2.如果使用ftp,很简单,服务器架设任意ftp服务器,然后通过ftp命令put就可以,使用tcpclient类
3.服务器上架设webservice,winform添加webservice引用上传
可以这样,button里写 window.open('xxx.php?fileName=aaaa'),然后这个php文件里根据这个fileName找到对应文件,然后在这个页面以文件流的形式输出到浏览器端,这样会生成保存文件对话框
我是搞C#的,C#的文件流输出到浏览器代码如下
stream = File.Open(filePathName, FileMode.Open, FileAccess.Read)byte[] data = new byte[stream.Length]
int result = stream.Read(data, 0, data.Length)
if (!File.Exists(filePathName))
return
HttpContext.Current.Response.Buffer = true
HttpContext.Current.Response.Charset = Encoding.UTF8.ToString()
HttpContext.Current.Response.AddHeader("Content-Disposition", "inlinefilename=" + Server.UrlEncode(fileName))
HttpContext.Current.Response.AddHeader("Content-Length", data.Length.ToString())
HttpContext.Current.Response.ContentType = "application/ms-excel"
stream.Close()
File.Delete(filePathName)
Response.BinaryWrite(data)
HttpContext.Current.ApplicationInstance.CompleteRequest()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)