看板 Visual_Basic 關於我們 聯絡資訊
現在的問題是處理一個FTP上傳檔案的問題 由於資料有4G這麼大 當我在資料上傳到一半的時候發生runtime error'63':資料錄個數不正確 請問一下這是一個什麼樣的問題? 下面有source code 發生錯誤的程式碼在 Get #ff, , sBuffer Public Function PutFile(ByVal LocalFile As String, ByVal Destination As String) As Boolean PutFile = False If Not (bActiveSession) Then Exit Function If Not (FileReal(LocalFile)) Then Exit Function Dim sBuffer As String * 1024 Dim FileData As String Dim SentBytes As Double Dim nRet As Long Dim spRate As Integer Dim nTotFileLen As Long Dim nFileLen As Long Dim hFile As Long Dim t As Long Dim ff As Integer ff = FreeFile DelFile = Destination Open LocalFile For Binary As #ff If (ff = 0) Then Exit Function nTotFileLen = LOF(ff) SentBytes = 0 nFileLen = 0 spRate = 0 hFile = FtpOpenFile(hConn, Destination, GENERIC_WRITE, FTP_TRANSFER_TYPE_BINARY, 0) If hFile = 0 Then Exit Function End If Do Get #ff, , sBuffer Label1.Caption = "檔案上傳中" Label1.Refresh If nFileLen < nTotFileLen - sReadBuffer Then If InternetWriteFile(hFile, sBuffer, sReadBuffer, nRet) = 0 Then Call RemoveFile(DelFile) Exit Function End If SentBytes = SentBytes + sReadBuffer nFileLen = nFileLen + sReadBuffer Else If InternetWriteFile(hFile, sBuffer, nTotFileLen - nFileLen, nRet) = 0 Then Call RemoveFile(DelFile) Exit Function End If SentBytes = SentBytes + (nTotFileLen - nFileLen) nFileLen = nTotFileLen End If Loop Until nFileLen >= nTotFileLen Close InternetCloseHandle hFile PutFile = True Label1.Caption = "檔案上傳完畢" Label1.Refresh Call ListRemoteFile(RemoteDir) End Function -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.155.49