Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All


FTPPutBinary (socket,binfield,remotefile) Returns status


Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded,allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

FTPPutBinary uploads the contents of an Omnis binary variable to a remote file on the FTP server. The data is transferred using binary transfer mode.

Socket is an Omnis Long Integer field containing a socket opened to an FTP server using FTPConnect.

BinField is an Omnis Binary or Character field containing the data to transfer.

RemoteFile is an Omnis Character field containing the pathname of the destination file on the FTP server.

Status is an Omnis Long Integer field which receives the result of executing the command. Possible error codes are listed in the Web Command Error Codes Appendix.


; upload a binary file to a FTP server
; set file transfer mode to binary
FTPType (iFTPSocket,1) Returns lErrCode
If not(lErrCode)
  ; select the binary file to upload
  Do FileOps.$getfilename(lDirName,'Select the binary file to upload','*.*',sys(115))
  Do lFileOps.$openfile(lDirName)
  ; read contents into an Omnis binary variable
  Do lFileOps.$readfile(lBinField)
  Calculate lRemoteFile as '/Test/upload/myUploadedFile'
  FTPPutBinary (iFTPSocket,lBinField,lRemoteFile) Returns lErrCode
  If lErrCode
    FTPGetLastStatus (iServerReplyText) Returns lErrCode
    OK message FTP Error {[con("Error uploading binary",upp(lDirName)," to ",upp(lRemoteFile),kCr,"Details follow: ",kCr,iServerReplyText)]}
  End If
End If