Hi, all !
I have total access to directory ftp. How I can copy file to this directory ?
Hi, all !
I have total access to directory ftp. How I can copy file to this directory ?
Natter, have you tried with:
FTPPutFile( hConnect, cUpFile, cUpFile, 0, 0 )
best regards,
Otto
Otto, thanks for your help.
What is "nConnect" ? What use - TFTP or TFTPClient ?
// 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
//----------------------------------------------------------------------------//Copy file from FTP to local computer I do with URLDownloadToFile() - it work fine.
If do FTPPutFile() from TFTP then It's not work.
Natter, what error do you get?
Best regards,
Otto
I not get error, but and file not copy to FTP
I do then :
function Main()
local oInternet := TInternet():New()
local oFTP := TFTP():New( "ftp.MyFtp", oInternet, login, password )
? oFTP = object
? oFTP:hFtp >0
? FTPPutFile( oFTP:hFtp, LocalFile, FtpFile, 0, 0 ) = .F.
return NIL
Examle .\samles\ftpdir.prg with this parameters work fine