Login  
Search All Forums
Dart Home | PowerTCP FTP for ActiveX | Custom Development Reply | PowerTCP FTP for ActiveX Topics | Forums   
AuthorForum: PowerTCP FTP for ActiveX
Topic: Excel File Corruption with FTP ActiveX control
bshah

From: Atlanta, GA USA
Posts: 11
Member Since: 08/08/02
posted March 30, 2004 3:56 PM

Hi,

We are using Dart FTP ActiveX control to FTP file from client machine to server. About 20% of the Excel files get corrupted during the move. Are you aware of any file corruption problem with this control??

Here is the FTP code logic in VB6:

Private Function IFiletransfer_PutFile(ByVal LocalFilePath As String, _
    ByVal RemoteFileName As String, _
    Optional ByVal ServerName As String = "", _
    Optional ByVal Overwrite As Boolean = True) As Boolean

     '********************************************
     'Declare error handler
     '********************************************
10    On Error GoTo ErrHandler
     '********************************************
     'Declare procedure constants
     '********************************************
14    Const PROC_NAME       As String = "IFiletransfer_PutFile()"
     '********************************************
     'Declare procedure variables
     '********************************************
     Dim TError         As Long
     Dim TErrorDesc       As String
     Dim TErrorSource      As String
     Dim oFso          As Scripting.FileSystemObject
     Dim sFTPLaunchPath     As String
     '********************************************
     'Procedure code
     '********************************************
26    sFTPLaunchPath = m_oUtility.GetKeyValue(FOLDER_PATHS, FTP_LAUNCH)

     'validate remotefilepath is not null
29    If Len(Trim$(LocalFilePath)) = 0 Then
30      Err.Raise CUST_ERR_TECH_NUM, _
           SRC_INTERNET_PUT_FILE, _
           ERR_MSG_LOCAL_FILE_NOT_EXIST
33    End If


     'Move File to FTP Temp directory for launch to FTP Server
37    Set oFso = CreateObject("Scripting.FileSystemObject")
  
39    oFso.CopyFile LocalFilePath, sFTPLaunchPath & RemoteFileName
  
41    SetAttr sFTPLaunchPath & RemoteFileName, vbNormal

     'reset error handler
44    On Error Resume Next
  
     Dim sSourcePath As String
  
48    sSourcePath = """" & sFTPLaunchPath & RemoteFileName & """"
  
50    oXFTP.TimeOut = m_oUtility.GetKeyValue(ENVIRONMENT, FTP_TIMEOUT)
  
52    Call oXFTP.MPut(sSourcePath)
  
54    oFso.DeleteFile sFTPLaunchPath & RemoteFileName

56    IFiletransfer_PutFile = True
  
58 ErrOut:
59    On Error Resume Next
     'Object cleanup and destruction goes here

62    If TError <> 0 Then
63      On Error GoTo 0
64      Err.Raise TError, TErrorSource, TErrorDesc
65      IFiletransfer_PutFile = False
66    End If

68    Exit Function

70 ErrHandler:
71    TError = Err.Number
72    TErrorDesc = Err.Description
73    TErrorSource = Err.Source
  
75    m_oErrorHandler.HandleError ecfENUser, _
         TError, _
         TErrorDesc, _
         TErrorSource, _
         Erl, _
         MODULE_NAME, _
         PROC_NAME

83    Resume ErrOut
  
End Function




Please advise!!

Thanks,
Bharat
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 30, 2004 8:24 PM

I don't see anywhere where you set the type of transfer to image, which is what you should use for files that may contain binary data.

Try setting Ftp.Type = ftpImage
bshah

From: Atlanta, GA USA
Posts: 11
Member Since: 08/08/02
posted April 6, 2004 10:06 AM

Thanks - Tony!!

We have made changes as per your suggestion and see if that makes the difference. Thanks for a prompt response.

Bharat
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 6, 2004 10:17 AM

No problem! Let me know if you need anything else.
Reply | PowerTCP FTP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX