This is my first experience in FTP, I am using tFtp to upload and download a small text file. But it is not working. Please any one can put a working code for upload and download a small text file.
Regards
Sanil
TFTP Help required
Re: TFTP Help required
Sanil,
here is example from this forum. I adapted some lines in my application:
Best regards,
Boris
here is example from this forum. I adapted some lines in my application:
Code: Select all
//---------------------------------------------------------------------------------------------------------------------
//
// FTPsend( "list.txt", "Text message ..." )
//
//---------------------------------------------------------------------------------------------------------------------
FUNCTION FTPsend(list,message)
LOCAL cUrl := "ftp://user:password@ftp.site.com"
LOCAL oUrl := TUrl():New( cUrl )
LOCAL oFtp := TIpClientFtp():New( oUrl, .t. )
oFtp:Open( cUrl )
lOk:=oFtp:uploadFile(list,"/var/www/wordpress/temp/"+list)
oFtp:Close()
if !empty( message )
if lOk
msgWait( message,,1.5 )
else
msgInfo( "Error ..." )
endif
endif
RETURN nil
Boris
Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)
Re: TFTP Help required
Thank you, Above code not working in both upload and download case(oFtp:uploadFile/oFtp:downloadFile). I foundbosibila wrote:Sanil,
here is example from this forum. I adapted some lines in my application:
Best regards,Code: Select all
//--------------------------------------------------------------------------------------------------------------------- // // FTPsend( "list.txt", "Text message ..." ) // //--------------------------------------------------------------------------------------------------------------------- FUNCTION FTPsend(list,message) LOCAL cUrl := "ftp://user:password@ftp.site.com" LOCAL oUrl := TUrl():New( cUrl ) LOCAL oFtp := TIpClientFtp():New( oUrl, .t. ) oFtp:Open( cUrl ) lOk:=oFtp:uploadFile(list,"/var/www/wordpress/temp/"+list) oFtp:Close() if !empty( message ) if lOk msgWait( message,,1.5 ) else msgInfo( "Error ..." ) endif endif RETURN nil
Boris
Code: Select all
INETERRORCODE (<pointer>) >> -4 <<
Regards
Sanil