nobody have these fact code for me>>>>>????????up myself

解决方案 »

  1.   

    shit!
    how can i finish this question!
    where is the adv person  here for .net ????????
      

  2.   

    http://www.yesky.com/20011016/200942.shtml
      

  3.   

    谢谢,文章我看了!可我要用上传到ftp服务器,saveas()不能实现这个功能!!他只能在物理路径!
      

  4.   

    我用stock了,而且联接成功了但是,一道传送文件就是 550的错误The filename, directory name, or volume label syntax is incorrect.送的本地文件路径为strPath="f:\test.txt"code:          WriteData(objTCPCommandStream, "CWD " & strPath & vbCrLf)          ....    Private Sub WriteData(ByVal NETStream As Object, ByVal sData As String)
            bytWriting = System.Text.Encoding.ASCII.GetBytes(sData)
            NETStream.Write(bytWriting, 0, bytWriting.Length)
        End Sub
    ?????????????????????急急急急急
      

  5.   

    代码如下
        Private Sub ftp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ftp.Click
            fileupload.SendFile("192.168.10.100", "test.txt", "username", "pwd", "f:\ftp.txt")
        End Sub--------------------------------------Imports System.IO
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.Text.RegularExpressionsModule fileupload
        Private bytWriting As [Byte]()
        Private bytReading As Byte()    Dim strAddress As String
        Dim strFtpIP As String
        Dim intPort As Integer
        Public Function SendFile(ByVal strFtpIP As String, _
                                ByVal strSaveAs As String, ByVal strUsername As String, _
                                ByVal strPassword As String, ByVal strPath As String)        If Left(strPath, 1) = "/" Or Left(strPath, 1) = "\" Then
                strPath = strPath.Remove(1, 1)
            End If
            If Right(strPath, 1) = "/" Or Right(strPath, 1) = "\" Then
                strPath = strPath.Remove(strPath.Length, 1)
            End If
            Dim objTCPCommand As New TcpClient()
            Dim objTCPData As New TcpClient()
            Dim objTCPCommandStream As NetworkStream
            Dim objTCPDataStream As NetworkStream        Try
                objTCPCommand.SendTimeout = 1000
                objTCPCommand.Connect(strFtpIP, "21")
                objTCPCommandStream = objTCPCommand.GetStream
                ReadData(objTCPCommand, objTCPCommandStream)            WriteData(objTCPCommandStream, "USER " & strUsername & vbCrLf)
                ReadData(objTCPCommand, objTCPCommandStream)
                WriteData(objTCPCommandStream, "PASS " & strPassword & vbCrLf)
                ReadData(objTCPCommand, objTCPCommandStream)
                WriteData(objTCPCommandStream, "PASV" & vbCrLf)            'get address from response
                strAddress = AddressRE.Match(ReadData(objTCPCommand, objTCPCommandStream)).ToString
                Dim strPort = portRE.Match(strAddress).ToString
                Dim strP1 = p1RE.Match(strPort).ToString
                Dim strP2 = p2RE.Match(strPort).ToString
                intPort = CInt(strP1) * 256 + CInt(strP2)            'make data connection
                objTCPData.SendTimeout = 1000
                objTCPData.Connect(strFtpIP, intPort)
                objTCPDataStream = objTCPData.GetStream            'change directory
                Dim b As Boolean = File.Exists(strPath)
                If b Then
                    If strPath <> "" Then                  '***这的返回550的错误The filename, directory name, or  
                      '**  volume label 
                        WriteData(objTCPCommandStream, "CWD " & strPath & vbCrLf)
                    End If
                End If            'save file
                ReadData(objTCPCommand, objTCPCommandStream)
                WriteData(objTCPCommandStream, "STOR " & strSaveAs & vbCrLf)
                'If blnMask = True Then
                'ReadData(objTCPCommand, objTCPCommandStream)
                'WriteData(objTCPDataStream, strFrame)
                'Else
                'WriteData(objTCPDataStream, strNoFrame)
                'End If            'close data connection
                ReadData(objTCPCommand, objTCPCommandStream)
                objTCPDataStream.Close()
                objTCPData.Close()            'quit and close control connection
                WriteData(objTCPCommandStream, "QUIT" & vbCrLf)
                objTCPCommandStream.Close()
                objTCPCommand.Close()        Catch Err As Exception
                MsgBox(Err.ToString)
            End Try
        End Function    Private Function ReadData(ByVal TCPClient, ByVal NETStream) As String
            Dim sData As String
            Do Until sData <> ""
                ReDim bytReading(TCPClient.ReceiveBufferSize)
                NETStream.Read(bytReading, 0, TCPClient.ReceiveBufferSize)
                sData = Trim(System.Text.Encoding.ASCII.GetString(bytReading))
                ReadData = sData
            Loop
        End Function    Private Sub WriteData(ByVal NETStream As Object, ByVal sData As String)
            bytWriting = System.Text.Encoding.ASCII.GetBytes(sData)
            NETStream.Write(bytWriting, 0, bytWriting.Length)
        End SubEnd Module
    为什么呢?//////////
      

  6.   

    有点晕!!
    是不是ReadData = sData他们的类型不匹配丫,你用属性type看看类型是否相同