Hi, all !
I have total access to directory ftp. How I can copy file to this directory ?
// Testing the FiveWin new Internet Classes
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, oTmr
DEFINE WINDOW oWnd TITLE "Timers"
DEFINE TIMER oTmr INTERVAL 10000 ACTION (oTmr:DeActivate(),oWnd:Say( 10, 17, Time() ), upload(),oTmr:Activate() ) of oWnd
ACTIVATE TIMER oTmr
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
oTmr:End()
return nil
//----------------------------------------------------------------------------//
FUNC upload()
local oInternet := TInternet():New()
local oFTP := TFTP():New( "ftp.test.info", oInternet,"testinfo", "test" )
local aFiles
LOCAL handle
local cFile := ""
if ! Empty( oFTP:hFTP )
/*
DLL32 FUNCTION FtpSetCurrentDirectory(
hFTP AS LONG,
cDirName AS LPSTR ) ;
AS BOOL PASCAL ;
*/
FtpSetCurrentDirectory(oFTP:hFTP, "/testinfo/STB1/")
aFiles = oFTP:Directory("*.*" )
IF len(aFiles) > 0
AEval( aFiles, { | aFile | msginfo( aFile[ 1 ] ),cFile := ALLTRIM( aFile[ 1 ] ),;
FtpGetFile (oFTP:hFTP,aFile[ 1 ], "c:\dbf\" + aFile[ 1 ] ,.t.,0,0,0 ) ,;
oFTP:DeleteFile( aFile[ 1 ]) } )
ENDIF
/*
DLL32 FUNCTION FtpGetFile(
hFTP AS LONG, = INTERNETCONNECT
cRemoteFile AS LPSTR
cLocalFile AS LPSTR
lOverWrite AS LONG
n1 AS LONG
n2 AS LONG
n3 AS LONG
*/
else
MsgAlert( "oFTP:hFTP is null" )
endif
oInternet:End()
//MsgInfo( "Done!" )
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 103 guests