Archived Forum Post

Index of archived forum posts

Question:

PutFile does not overwrite my existing file

Jun 01 '15 at 11:28

Dear Sir,

I would like to know why PutFile does not overwrite my remote file and still returns a success message. I am running the same process twice where a file from my local pc is transferred to a server over ftp. After the second run, the file on the ftp would still be from the first run!

Thanks, Justin


Accepted Answer

You set the Ftp2.RestartNext property = true, and this indicates that the upload is to be resumed. If you are not resuming an upload, make sure that RestartNext = false so that the entire file is uploaded and the destination file is overwritten.


Answer

Please post the contents of the LastErrorText (with VerboseLogging turned on) so I can see what transpired..


Answer

Chilkat, thanks for your concerns and explanation. I am certainly writing to the same remote path. The problem persists...here is the LastErrorText you asked for extracted exactly after the response from PutFile during the second run (when the file is supposed to overwrite but did not!).

ChilkatLog:
  PutFile(390ms):
    DllDate: Oct  1 2014
    ChilkatVersion: 9.5.0.44
    UnlockPrefix: EPHREMFTP
    Username: WS20:justin.farrugia
    Architecture: Little Endian; 32-bit
    Language: .NET 4.5
    VerboseLogging: 1
    LocalFilename: C:Usersjustin.farrugiaDesktopJustinTasks7 - StatementsTemp00047095841000002630004709584100000263_2015-5-17.pdf
    RemoteFilename: 0004709584100000263_2015-5-17.pdf
    ProgressMonitoring:
      enabled: yes
      heartbeatMs: 0
      sendBufferSize: 65536
    --ProgressMonitoring
    IdleTimeoutMs: 60000
    ReceiveTimeoutMs: 60000
    ConnectTimeoutSeconds: 60000
    uploadFromLocalFile(390ms):
      localFileSize: 115352
      uploadFromDataSource(390ms):
        initialGreeting: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 25 allowed.
220-Local time is now 07:14. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
        restartNext: 1
        modeZ: 0
        binaryMode: 1
        setupResumeUpload(63ms):
          sizeCmd(63ms):
            sizeCmdInner(63ms):
              sendCommand:
                sendingCommand: SIZE 0004709584100000263_2015-5-17.pdf
              --sendCommand
              readCommandResponse(63ms):
                replyLineQP: 213 115352
                commandResponse: 213 115352
                statusCode: 213
                readResponse: Elapsed time: 63 millisec
              --readCommandResponse
              size: 115352
            --sizeCmdInner
          --sizeCmd
          SizeCommandForAppendRestart: Elapsed time: 63 millisec
        --setupResumeUpload
        pbsz_protp(109ms):
          sendCommand:
            sendingCommand: PBSZ 0
          --sendCommand
          readCommandResponse(47ms):
            replyLineQP: 200 PBSZ=3D0
            commandResponse: 200 PBSZ=0
            statusCode: 200
            readResponse: Elapsed time: 47 millisec
          --readCommandResponse
          sendCommand:
            sendingCommand: PROT P
          --sendCommand
          readCommandResponse(62ms):
            replyLineQP: 200 Data protection level set to "private"
            commandResponse: 200 Data protection level set to "private"
            statusCode: 200
            readResponse: Elapsed time: 62 millisec
          --readCommandResponse
        --pbsz_protp
        setupDataConnection(94ms):
          passive transfer mode
          setupPassiveDataSocket(94ms):
            sendCommand:
              sendingCommand: PASV
            --sendCommand
            readCommandResponse(47ms):
              replyLineQP: 227 Entering Passive Mode (77,72,202,10,117,95)
              commandResponse: 227 Entering Passive Mode (77,72,202,10,117,95)
              statusCode: 227
              readResponse: Elapsed time: 47 millisec
            --readCommandResponse
            PassiveHostAddress: 77.72.202.10
            passiveHostAddr: 77.72.202.10
            dataConnect(47ms):
              hostname: 77.72.202.10
              port: 30047
              socket2Connect(47ms):
                connect2(47ms):
                  hostname: 77.72.202.10
                  port: 30047
                  ssl: 0
                  connectSocket(47ms):
                    domainOrIpAddress: 77.72.202.10
                    port: 30047
                    connectTimeoutMs: 60000000
                    connect_ipv6_or_ipv4(47ms):
                      This is an IPV4 numeric address.
                      Domain to IP address resolution not needed.
                      AddrInfoList:
                        AddrInfo:
                          ai_flags: 4
                          ai_family: 2
                          ai_socktype: 1
                          ai_protocol: 0
                          ai_addrlen: 16
                          ai_canonname: (NULL)
                        --AddrInfo
                      --AddrInfoList
                      connecting to IPV4 address...
                      ipAddress: 77.72.202.10
                      connect(47ms):
                        Waiting for the connect to complete...
                        myIP: 192.168.10.55
                        myPort: 54679
                        socket connect successful.
                      --connect
                    --connect_ipv6_or_ipv4
                  --connectSocket
                --connect2
              --socket2Connect
              socketOptions:
                SO_SNDBUF: 8192
                SO_RCVBUF: 8192
                TCP_NODELAY: 0
              --socketOptions
              dataConnectSuccess: 1
            --dataConnect
          --setupPassiveDataSocket
          setupPassiveDataSocket: Elapsed time: 94 millisec
        --setupDataConnection
        sendUploadCommand:
          sendCommand:
            sendingCommand: APPE 0004709584100000263_2015-5-17.pdf
          --sendCommand
        --sendUploadCommand
        convertDataConnToSsl(62ms):
          convertToTls(62ms):
            clientHandshake(62ms):
              clientHandshake2(62ms):
                processHandshakeRecord:
                  processHandshakeMessage:
                    processServerHello:
                      HelloExtension: renegotiation_info
                      HelloExtensionLen: 1
                    --processServerHello
                  --processHandshakeMessage
                --processHandshakeRecord
              --clientHandshake2
            --clientHandshake
            Secure Channel Established.
          --convertToTls
          ConvertToTls: Elapsed time: 62 millisec
        --convertDataConnToSsl
        Reading intermediate response for upload...
        readCommandResponse:
          replyLineQP: 150 Accepted data connection
          commandResponse: 150 Accepted data connection
          statusCode: 150
          readResponse: Elapsed time: 0 millisec
        --readCommandResponse
        intermediateResponseStatusCode: 150
        intermediateReply: 150 Accepted data connection
        sendUploadFileData:
          sendBufferSize: 65536
          Sending uncompressed...
          UploadData: Elapsed time: 0 millisec
        --sendUploadFileData
        closingDataConnection(62ms):
          shutdownChannel(62ms):
            sending close notify...
            sendCloseNotify:
              Turning on TCP_NODELAY.
            --sendCloseNotify
            reading SSL/TLS close notify...
            (bForceClose) socket shutdown..
            terminateConnection(15ms):
              TCP connection cleanly closed by peer.
              Cleanly terminated TCP connection.
            --terminateConnection
          --shutdownChannel
        --closingDataConnection
        skipFinalReply: 0
        Reading final response...
        readCommandResponse:
          replyLineQP: 226 File successfully transferred
          commandResponse: 226 File successfully transferred
          statusCode: 226
          readResponse: Elapsed time: 0 millisec
        --readCommandResponse
        FinalReply: Elapsed time: 0 millisec
        uploadRate: 0
        cumulativeNumBytesSent: 0
      --uploadFromDataSource
    --uploadFromLocalFile
    TotalTime: Elapsed time: 390 millisec
    Success.
  --PutFile
--ChilkatLog