ftp

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
nelstu
Posts: 60
Joined: Mon Jul 30, 2012 10:41 pm

ftp

Post by nelstu »

Hola baje este codigo y lo agregue a mi sistema, lee el directorio y lo envia a un ftp

se conecta
Me sube el primer archivo y los demas no los sube, aunque lo lista
Alguien ha trabajado con ftp

cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer

/* Leemos ficheros a enviar */
cCarpeta:="C:\AppServ\www\horas\"

aFFList := HB_DirScan( cCarpeta )




IF Len( aFFList ) > 0

oUrl := tUrl():New( cUrl )
oFTP := tIPClientFtp():New( oUrl, .T. )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .T.
IF oFTP:Open( cUrl )

If len(cPath)>0
If !oFtp:CWD( cPath )
msginfo("Respuesta del servidor:"+ oFtp:cReply )

Endif
EndIf

FOR EACH x1Row IN aFFList

// msginfo ( cPath+x1Row[ 1 ] )


oFtp:UploadFile( cPath+x1Row[ 1 ] )

NEXT x1Row


oFTP:Close()
ELSE
msginfo("No se ha podido conectar con el servidor FTP" + " " + oURL:cServer )
IF oFTP:SocketCon == NIL
msginfo( "Conexi?n no inicializada" )
ELSEIF hb_InetErrorCode( oFTP:SocketCon ) == 0
msginfo("Respuesta del servidor:" + " " + oFTP:cReply )
ELSE
msginfo( "Error en la conexi?n:" + " " + hb_InetErrorDesc( oFTP:SocketCon ) )
ENDIF

lRetorno := .F.
ENDIF
ENDIF
msginfo("Finalizada...")
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

ftp

Post by Pablo César »

I did not analyze your code but ...

There are many topics that the colleagues here in the forum have approached about the topic.

Here are some links for you to see examples:
viewtopic.php?t=2863
viewtopic.php?t=243
viewtopic.php?t=579
viewtopic.php?t=4902&start=40

Please next time it would be convenient to make your code available between CODE TAGs.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply