Jump to content


Photo

Presales help


  • Please log in to reply
1 reply to this topic

#1 lolo787520

lolo787520
  • Members
  • 1 posts

Posted 26 April 2006 - 08:46 AM

your ftp lib is awesome .

i will be grateful if you can help me .
i build this code like your example


Private Sub upload_file_smartftp(local_name, onserver_file, 0, 0)

Dim nRestartLo: nRestartLo = 0
Dim nRestartHi: nRestartHi = 0
Dim strMsg As String
If objFTP.UploadFile(local_name, onserver_filw, nRestartLo, nRestartHi) = sfFTPLib.enumError.ftpErrorSuccess Then
strMsg = " Upload successful." & vbCrLf
Else
strMsg = "uploadFile failed. LastError = " & objFTP.LastError & vbCrLf
Call resume_UploadFile(local_name, onserver_filw, local_size, bResume)
End If


End Sub

'*****************************************************************************
Private Sub resume_UploadFile(strLocalFile, strRemoteFile, local_size, bResume)


Dim nRestart: nRestart = 0 ' overwrite by default
Dim bSkip: bSkip = False ' don't skip, unless equal size
Dim nLocalFileSize: nLocalFileSize = local_size
Dim result

' Get Remote File Size
result = objFTP.GetFileSize(strRemoteFile)

If result = ftpErrorSuccess Then
Dim nRemoteFileSize: nRemoteFileSize = objFTP.LastFileSizeLo
If nLocalFileSize = nRemoteFileSize Then
bSkip = True
' MsgBox (" file equal")
nRestart = 0
ElseIf nLocalFileSize > nRemoteFileSize Then
' Only resume if local size is greater than remote size
nRestart = nRemoteFileSize
End If
End If

' UploadFile
result = objFTP.UploadFile(strLocalFile, strRemoteFile, nRestart, 0)
If result = ftpErrorSuccess Then
bResume = True
Else
bResume = False
End If
End Sub


from some reason when i kick my connection the program start transfer from begining
i get 0 in result = objFTP.GetFileSize(strRemoteFile) even when i see this file in my browser and size>0
my server support resume (i try this in your client ftp 2 )
can you see any error in this code

Thank you for you patience

#2 mb

mb

    Developer

  • Administrators
  • 11527 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 26 April 2006 - 08:48 AM

The GetFileSize functionh returns 0 if there is no error. The file size value is in the LastFileSize(Lo|Hi) property.

You should always call the resume_UploadFile function because the other one (upload_file_smartftp) will not resume your transfer.

Regards,
-Mat




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users