ftp上传问题,了解的兄弟近来帮我
=========
代码如下
=========
Protected Sub Button1_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.ServerClick
Dim fileInf As New System.IO.FileInfo( "c:\1234.jpg ")
Const host As String = "ftp://www.wye.cn "
Const username As String = "keke "
Const password As String = "3537 "
Dim uri As String = host + "/ " + fileInf.Name.ToString
Dim ftp As System.Net.FtpWebRequest = CType(System.Net.FtpWebRequest.Create(uri), System.Net.FtpWebRequest)
ftp.Credentials = New System.Net.NetworkCredential(username, password)
ftp.KeepAlive = False
ftp.UseBinary = True
ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim response0 As System.Net.FtpWebResponse = CType(ftp.GetResponse, System.Net.FtpWebResponse)
Dim responsestream As System.IO.Stream = ftp.GetRequestStream
Dim fs As IO.FileStream
fs = fileInf.OpenRead
Dim buffer(2048) As Byte
Dim read As Integer = 0
Do
read = fs.Read(buffer, 0, buffer.Length)
responsestream.Write(buffer, 0, read)
Loop Until read = 0
responsestream.Close()
fs.Flush()
fs.Close()
response0.Close()
Response.Write( "sssssssssssssssssssssssssssssssssssssssssssssc ")
End Sub
================================================
我把这个网页放在服务器A上index.aspx
FTP在www.wye.cn的服务器上
我现在在B电脑上访问A服务器的上边的网页index.aspx,点按钮,执行上边的代码!
我的原意是想把B电脑本地的文件“c:\1234.jpg”传到FTP服务器上,可是不知道为什么,我把服务器A上的c:\1234.jpg这个文件传到了FTP服务器上
==========
请问问题出在哪里了
应怎么样解决
谢谢大家帮我