Command FTP_Receive

4D Internet Commands

FTP_Receive

version 6.5


FTP_Receive (ftp_ID; hostPath; localPath; progress) Integer

ParameterTypeDescription
ftp_IDLongintReference to a FTP login
hostPathTextPathname of document to receive
localPathTextPathname to destination of document
Resulting file pathname (if "" passed)
progressInteger0 = Hide Progress, 1 = Show Progress

Function result Integer Error Code

Description

The FTP_Receive command receives a file using the File Transfer Protocol from the path referenced by hostPath. FTP_Receive will return an error# -48 if the destination file already exists.

ftp_ID is the long integer reference to the FTP session established with FTP_Login.

hostPath is a text value that specifies the path of the document to be received. If hostPath is not a full path to a document, the command will return an error. As with all paths to Unix documents, the path should be separated by slashes ("/"). For more information, see the section entitled Glossary and Terminology at the beginning of the manual.

localPath is a text value that specifies the path of the destination of the document. If localPath is a null string, the user will be presented with a Standard Save-File Dialog and the resulting file pathname will be returned back into the localPath variable. If localPath contains only a filename, the file will be saved in the same folder as the structure of the database (with 4D single-user) or the 4D Client folder (with 4D Server). As with all paths to local documents, the path should be separated by the delimiter appropriate for the platform the externals are being used. For more information, see the section entitled Glossary and Terminology at the beginning of the manual.

progress is an integer value indicating whether the Progress indicator should be displayed or not. A value of 1 will display the progress indicator. A value of zero will hide the progress indicator.

Example

   vUseMacBin:=-1
   $error:=FTP_MacBinary (vFTP_ID;vUseMacBin)
   If($error=10053)
      MacBinaryIsSupported:=False `Ftp server doesn't support the MacBinary protocol
   Else
      MacBinaryIsSupported:=True
   End if

   vLocalFile:=""
   If(MacBinaryIsSupported)
      vUseMacBin:=1
      $error:=FTP_MacBinary (vFTP_ID;vUseMacBin)  `Try to turn MacBinary on for the download
      $error:=FTP_Receive (vFTP_ID;"CGMiniViewer.hqx";vLocalFile;cbShowTherm)
      If ($error=0) & (vUseMacBin=1)
         vDecodePath:=""
         If (IT_Decode (vLocalFile;vDecodePath;8)=0)  `MacBinary decode
            DELETE DOCUMENT(vLocalFile)  `If successful decode of source, then delete it.
         End if 
      End if 
   End if  

See Also

FTP_MacBinary, IT_Decode.