HMG FTP Sample ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG FTP Sample ?

Post by danielmaximiliano »

Jimmy: your code is wrongly building the url.
2020-06-21 10_53_33-Window.png
2020-06-21 10_53_33-Window.png (44.97 KiB) Viewed 2582 times

Code: Select all

   cUrl := cProtocol + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer )
   msgbox (cUrl, "Site")        /* bad URL */
   oUrl := tURL() :New( cUrl )
   IF EMPTY( oUrl )
      RETURN nil
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,

Source is from MiniGUI Extended Version. i just try to run it with HMG "pure" ;)

as i know Syntax is

Code: Select all

"ftp://" + UserName + ":" + Password + "@" + ServerName
you can try the String with FF, IE or EDGE to connect to FTP

but the Problem is not to connect to FTP-Site ... it is download of "some" files which don´t work
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,

now i saw in Logfile
>> 11-23-17 10:02PM 196572273 Devcon Party_2.mkv
11-23-17 09:09PM 121868933 DevConParty_1.mkv
11-23-17 09:49PM 2466639002 Express++ Roger Donnay.mkv
04-24-18 02:03PM 1609613369 OOP Hoffmann deutsch.mkv
04-30-18 05:02PM 1160915531 OOP in der Praxis Andreas Herdt.mkv
04-30-18 01:27PM 1514723673 OOP MH english.mkv
04-30-18 01:27PM 1381491719 Steffen Piersig Advanced SQL deutsch (Anfang fehlt).mkv
so i did "extract" Name wrong ...
have fun
Jimmy
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG FTP Sample ?

Post by danielmaximiliano »

Jimmy :
how to compile your minigui example
I am not a HMGext user
I try to use the Batch compile.bat and it gives me a compilation error
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,

i have change

Code: Select all

   acDir := oClient:listFiles()
to

Code: Select all

   acDir := oClient:list()

Code: Select all

#ELSE
   ftpMain.Grid_2.DisableUpdate
   ftpMain.Grid_2.DeleteAllItems

   acDir := oClient:list()                      // on serverside
   avalues := AtInside( CRLF, acDir )    // make Array from String
   iMax := LEN( avalues )
   FOR x := 1 TO iMax
      cLine := avalues[ x ]
      cDate := SUBSTR(cLine,1,8)
      cTime := SUBSTR(cLine,11,7)
      cSize := SUBSTR(cLine,18,22)
      cFile := SUBSTR(cLine,40)

      IF !EMPTY(cFile)
         nDirImg := IF( 'DIR' $ cSize , 0, 1 )

         ftpMain.Grid_2.AddItem( { nDirImg, ;
                                   cFile, ;
                                   LTRIM(cSize), ;
                                   cDate, ;
                                   cTime, ;
                                   "" } )
      ENDIF
   NEXT
#ENDIF

   ftpMain.Grid_2.EnableUpdate
RETURN nil
now i can download all files :D
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,
danielmaximiliano wrote: Sun Jun 21, 2020 2:03 pm Jimmy: your code is wrongly building the url.
as i say : it is not "my" Code ... i made it from MinuGUI Extended Version Sample just ready for HMG
Modification "in" Code most use

Code: Select all

#IFDEF 
#ELSE 
#ENDIF 
so i leave Original Code untouched

it was the GRID which display Data "wrong" so i try to find other Way to fill GRID.
i have use o:listFiles() as Serge say but i´m not sure about it any more
now i use o:list() but "miss Attribute" now.

---

you have "@" in User Name but @ is the "delimiter" for Server in String -> wrong URL
i also had a Password with "?" which does not work so some Sign have "special" function in this URL Syntax.

try it in your Browser (FF, IE or EDGE)

Code: Select all

ftp://ftp2019:Aio3t19?@vserver.xbaseentwickler.de
this will lead you to Google or Bing as there is "?" in Password ( not valid any more ... )

i was told it is possible to use "@" or "?" but you can´t send it in URL-String

Code: Select all

   cUrl := "ftp://@vserver.xbaseentwickler.de"
   oUrl := tURL() :New( cUrl )
   oClient := TIpClientFtp():new( oUrl, Sites->Log )
now Browser will ask for User and Password
have fun
Jimmy
User avatar
serge_girard
Posts: 3312
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: HMG FTP Sample ?

Post by serge_girard »

Ampersand and questionmark in URL are supposed to mark parameters such as:

Code: Select all

https://hmgforum.com/viewtopic.php?f=5&t=6482&start=10

Serge
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,
danielmaximiliano wrote: Sun Jun 21, 2020 10:50 pm how to compile your minigui example
I am not a HMGext user

I try to use the Batch compile.bat and it gives me a compilation error
do you mean c:\MiniGUI\SAMPLES\Advanced\FtpClient\Compile.bat :?:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG FTP Sample ?

Post by AUGE_OHR »

hi,
serge_girard wrote: Mon Jun 22, 2020 8:51 am Ampersand and questionmark in URL are supposed to mark parameters such as:
hm ... how to validate if User want to type it into TEXTBOX :idea:
have fun
Jimmy
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: HMG FTP Sample ?

Post by edk »

AUGE_OHR wrote: Mon Jun 22, 2020 12:33 am hi,
danielmaximiliano wrote: Sun Jun 21, 2020 2:03 pm Jimmy: your code is wrongly building the url.
as i say : it is not "my" Code ... i made it from MinuGUI Extended Version Sample just ready for HMG
Modification "in" Code most use

Code: Select all

#IFDEF 
#ELSE 
#ENDIF 
so i leave Original Code untouched

it was the GRID which display Data "wrong" so i try to find other Way to fill GRID.
i have use o:listFiles() as Serge say but i´m not sure about it any more
now i use o:list() but "miss Attribute" now.

---

you have "@" in User Name but @ is the "delimiter" for Server in String -> wrong URL
i also had a Password with "?" which does not work so some Sign have "special" function in this URL Syntax.

try it in your Browser (FF, IE or EDGE)

Code: Select all

ftp://ftp2019:Aio3t19?@vserver.xbaseentwickler.de
this will lead you to Google or Bing as there is "?" in Password ( not valid any more ... )

i was told it is possible to use "@" or "?" but you can´t send it in URL-String

Code: Select all

   cUrl := "ftp://@vserver.xbaseentwickler.de"
   oUrl := tURL() :New( cUrl )
   oClient := TIpClientFtp():new( oUrl, Sites->Log )
now Browser will ask for User and Password
try:

Code: Select all

cSrvFTP := "vserver.xbaseentwickler.de"
cUrl:= "ftp://" + cSrvFTP

oUrl:= tUrl():New( cUrl )
oFTP:= TIPClientFtp():New( oUrl, .F. )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv     := .T.

oFTP:oUrl:cServer := cSrvFTP
oFTP:oUrl:cUserID := UserName 
oFTP:oUrl:cPassword := Password
for progressbar U can use:

Code: Select all

oFtp:exGauge := { | done, size| any_disp_progressbar_function( INT( ( done / size ) *100 ) )  }
Post Reply