4D Internet Commands v16

FTP_Receive

Home

 
4D Internet Commands v16
FTP_Receive

FTP_Receive 


 

FTP_Receive ( ftp_ID ; hostPath ; localPath ; progress ) -> Function result 
Parameter Type   Description
ftp_ID  Longint in Reference to a FTP login
hostPath  Text in Pathname of document to receive
localPath  Text in Pathname to destination of document
in Resulting file pathname (if "" passed)
progress  Integer in 0 = Hide Progress, 1 = Show Progress
Function result  Integer in Error Code

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

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC File Transfer
Number: 88936

 
HISTORY 

Created: 4D Internet Commands 6.5

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v16)