Send and Receive for FTP

Send and Receive for FTP

Postby Kleyton » Sat Nov 14, 2009 4:47 pm

The code below shows the files from the ftp. I would like an example of sending and receiving a file via ftp.

Code: Select all  Expand view
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oInternet := TInternet():New()
   local oFTP      := TFTP():New( "ftp.brturbo.com.br", oInternet,"usuariodemo","senha123" )
   local aFiles

   if ! Empty( oFTP:hFTP )
      aFiles = oFTP:Directory( "*.*" )
      AEval( aFiles, { | aFile | MsgInfo( aFile[ 1 ], aFile[ 3 ] ) } )
   else
      MsgAlert( "oFTP:hFTP is null" )
   endif

   oInternet:End()

   MsgInfo( "Done!" )

return nil
Kleyton
Fwh906
Brazil
Kleyton
 
Posts: 49
Joined: Thu Dec 22, 2005 12:50 pm

Re: Send and Receive for FTP

Postby Otto » Sat Nov 14, 2009 5:38 pm

Best regards,
Otto

//? FTPGETFILE( hConnect, "Your remote file", "Your local file", 0, FILE_ATTRIBUTE_ARCHIVE, 0, 0 )
//? FTPPUTFILE( hConnect, "Your local file", "Your remote file", 0, 0 )


Code: Select all  Expand view
IF len(aFiles) > 0

AEval( aFiles, { | aFile | FtpGetFile (oFTP:hFTP,aFile[ 1 ], "c:\dbf\" + aFile[ 1 ] ,.t.,0,0,0 ) ,;
oFTP:DeleteFile( aFile[ 1 ]) } )

ENDIF


FTPPUTFILE( oFTP:hFTP, "
test.pdf", "/testserver/STB1/test.pdf", 0, 0 )


********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: Send and Receive for FTP

Postby Kleyton » Mon Nov 16, 2009 5:10 pm

Otto, thank you for responding.
where I find the manual on this process of ftp?
Kleyton
Fwh906
Brazil
Kleyton
 
Posts: 49
Joined: Thu Dec 22, 2005 12:50 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests