Saludos Carlos, un colega me paso la clase FTP y la aumente en mi codigo, no se si de tanto codigo tengo alguna libreria o clase anterior, simplemehte aumente el codigo de la clase y me funciono, creo q es igual que la que esta en FWH pero por si acaso la copio
include "FiveWin.ch"
include "Struct.ch"
define INTERNET_SERVICE_FTP 1
define FTP_PORT 21
//----------------------------------------------------------------------------//
CLASS TFTP
DATA oInternet // TInternet container object
DATA cSite // URL address
DATA hFTP // handle of the FTP connection
DATA cUserName // user name to login
DATA cPassword // password to login
METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CONSTRUCTOR // generic constructor
METHOD End() // generic destructor
METHOD DeleteFile( cFileName ) // deletes a remote FTP file
METHOD Directory( cMask ) // as Clipper Directory() but on a FTP site!
METHOD RenameFile( cOldFileName, cNewFileName ) // renames a file
METHOD SetCurrentDirectory( cDirName ) INLINE ;
FtpSetCurrentDirectory( ::hFTP, cDirName )
METHOD CreateDirectory( cDirName ) INLINE ;
FtpCreateDirectory( ::hFTP, cDirName )
ENDCLASS
//----------------------------------------------------------------------------//
//METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CLASS TFTP
//
// ::oInternet = oInternet
// ::cSite = cFTPSite
// ::cUserName = cUserName
// ::cPassword = cPassword
//
// if oInternet:hSession != nil
// ::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;
// ::cUserName, ::cPassword,;
// INTERNET_SERVICE_FTP, 0, 0 )
// AAdd( oInternet:aFTPs, Self )
// endif
//
//return Self
METHOD New( cFTPSite, oInternet, cUserName, cPassword, nFlags ) CLASS TFTP
DEFAULT nFlags := INTERNET_FLAG_PASSIVE
::oInternet = oInternet
::cSite = cFTPSite
::cUserName = cUserName
::cPassword = cPassword
if oInternet:hSession != nil
::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;
::cUserName, ::cPassword,;
INTERNET_SERVICE_FTP, nFlags, 0 )
AAdd( oInternet:aFTPs, Self )
endif
return Self
//----------------------------------------------------------------------------//
METHOD End() CLASS TFTP
if ::hFTP != nil
InternetCloseHandle( ::hFTP )
::hFTP = nil
endif
return nil
//----------------------------------------------------------------------------//
METHOD DeleteFile( cFileName ) CLASS TFTP
return If( ::hFTP != nil, FtpDeleteFile( ::hFTP, cFileName ), .f. )
//----------------------------------------------------------------------------//
METHOD Directory( cMask ) CLASS TFTP
local hFTPDir, aFiles := {}
local oWin32FindData, cBuffer
DEFAULT cMask := "."
STRUCT oWin32FindData
MEMBER nFileAttributes AS DWORD
MEMBER nCreationTime AS STRING LEN 8
MEMBER nLastReadAccess AS STRING LEN 8
MEMBER nLastWriteAccess AS STRING LEN 8
MEMBER nSizeHight AS DWORD
MEMBER nSizeLow AS DWORD
MEMBER nReserved0 AS DWORD
MEMBER nReserved1 AS DWORD
MEMBER cFileName AS STRING LEN 260
MEMBER cAltName AS STRING LEN 14
MEMBER dummy AS STRING LEN 50
ENDSTRUCT
if ::hFTP != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )
oWin32FindData:cBuffer = cBuffer
if ! Empty( oWin32FindData:cFileName )
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
end
endif
InternetCloseHandle( hFTPDir )
endif
return aFiles
//----------------------------------------------------------------------------//
METHOD RenameFile( cOldFileName, cNewFileName ) CLASS TFTP
return If( ::hFTP != nil, FtpRenameFile( ::hFTP, cOldFileName, cNewFileName ), .f. )