Any expert help.

I need to write a code download ftp files to local. Now it is nearly completely execpt sometimes I will get the error code: FtpGetFile error code 12031

mostly, it happened when I download huge folders. Now I either need to fix this error or just disconnect and redownload files again.

I don't know how to do either one. For the second way, I need to check if the existing file has been downloaded completely when the error happened. If it is not completely downloaded, resume the download.

Any one can help me on how to check if the file downloaded completely? Do I need to check the file size or anything else? What kind of function I should use.
Or anyone has any idea about how to fix the error.

Thank you thank you in advanced. Please give me any idea.

the following is my main part of my downloading file code:

Private Sub DownloadFile(dlFile As String)
Dim bRet As Boolean
Dim szFileLocal As String
Dim success%

If bActiveSession Then
szFileLocal = tmpPathStr 'local file path

'Check file exists
'A full path and filename. Call FileExists function
success% = FileExists%(szFileLocal & "/" & dlFile)
If success% = False Then 'new file
bRet = FtpGetFile(hConnection, dlFile, szFileLocal & "/" & dlFile, True, _
If bRet = False Then ErrorOut Err.LastDllError, "FtpGetFile"
'file exists but need rusume NEED HELP!!!
If ( local file exists but did not download completely ) Then
bRet = FtpGetFile(hConnection, dlFile, szFileLocal & "/" & dlFile, False, _
end if

End If
MsgBox "Not in session"
End If
End Sub