Connect to Ftp Server problem

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Connect to Ftp Server problem

Post by quartz565 »

Hello all,

We are making an app which will let us upload some files to our ftp server automatically, but we've encountered the following problem:
While creating the string using the TipClientFtp() class, for example: "ftp://username:password@www.exampleserver.com" we cannot connect to the server when the password or username part contains the character "@"(which is necessary when creating new ftp account under cpanel inside the website).
So if the username looks like "John@www.exampleserver.com" then the ftp oReply returns "Server not found". Exactly the same thing happens when using a similar password containing the "@" character.

We've also tried to break the string into pieces creating a new TUrl() object and then passing it to the TipClientFtp(). But we had exactly the same results.

Any ideas?

Thanks in advance.

Nikos
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Connect to Ftp Server problem

Post by danielmaximiliano »

Hola Nikos / Hi Nikos

Intenta con : Try With

Code: Select all

   cServer   := "ftp://johnsjn22.twentytwo.axc.nl"   
   cUser     := "Eldemo@johnsjn22.twentytwo.axc.nl"
   cPassword := "12345"  

   cUrl                 := cServer
   oUrl                 := TUrl():New( cUrl )
      oFTP              := TIPClientFTP():New( oUrl, .T. )
      oFTP:nConnTimeout := 20000
      oFTP:bUsePasv     := .F.

      /* Comprobamos si el usuario contiene una @ para forzar el userid */
      IF At( "@", cUser ) > 0
         oFTP:oUrl:cServer   := cServer
         oFTP:oUrl:cUserID   := cUser
         oFTP:oUrl:cPassword := cPassword
		 
      ENDIF
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: Connect to Ftp Server problem

Post by quartz565 »

Thank you Daniel!
I will try this.
Nikos
Best Regards,
Nikos.

os: Windows Server 2019 - 64
Post Reply