by vilian » Fri Jan 26, 2007 12:23 pm
Antonio,
This code is
FUNCTION EnvArqFtp(cArq)
LOCAL oInternet,oFtp,nVezes:=0,lInter:=.F.
oInternet := TInternet():New()
oFTP := TFTP():New( "ip by server", oInternet,"usr","pass" )
MandaArq(CurDir()+"\"+cArq,"/public_html/sav/"+cArq,500,oFTP)
RETURN NIL
STATIC FUNCTION MandaArq(cArquivo,cRemote,nTam,oFtp)
LOCAL n,hSource,cBuffer:=Space( 6400 ),nBufSize:=6400,oFile
IF (hSource := FOpen( cArquivo )) < 0
RETURN .F.
ELSE
cBuffer := Space( 6400 )
nBufSize := 6400
SysRefresh()
oFile := TFtpFile():New( cRemote, oFTP )
IF Empty(oFile)
RETURN .F.
ELSE
oFile:OpenWrite()
FSeek( hSource, 0, 0 )
nTotal := 0
DO WHILE ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0
nFeito := oFile:Write( SubStr( cBuffer, 1, nBytes ) )
SysRefresh()
nTotal += nBytes
ENDDO
oFile:End()
FClose( hSource )
ENDIF
ENDIF
RETURN .T.