FTP Directory

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

FTP Directory

#1 Post by Victorio »

Hi,
who works with xb2net, know why oFtp:Directory() return still NIL ?
FTP connection works, also set/get current directory, and also create directory. Only Directory() not.
Local oFtp, bCallback,pripftpok2:=.F.
Local aDir
Local cPath:="",cFlag:="",cFlag2:="",cFlag3:="" // musím predvoliť, lebo chce hoci žiadne, ale preddefinované ako pôv.fnx TESTFTP

cServer:=ftpserver2
cUserID:=ftpmeno2
cPassword:=ftpheslo2
qcislookresu:=uradokresn // toto načítané z nast.konfigurácie, uradokresn je character tj. "807"
qcisloku:=alltrim(qcisloku)
cPath:="LVPDF//807//KU800490"

cFlag := lower(var2char(cFlag) + var2char(cFlag2) + var2char(cFlag3))
oFtp := xbFTPClient():new()
oFtp:PassiveMode := "/passive" $ cFlag
oFtp:SecureDataChannel:= "/securedata" $ cFlag
oFtp:RecvTimeout(30000)
oFtp:SendTimeout(30000)

* ak v parametroch cFlag zadané show tak niečo asi zobrazí asi status , ale to nepoužívam cFlag prázdny
if "/show" $ cFlag
// set callback to see what's going on
// this codeblock will display status/progress info in terminal window:
oFtp:SetCallBack({|a,b| DisplayStatus(a,b)})
endif

* pripojenie k FTP, s kontrolou, či sa podarilo
if ! oFtp:Connect( cServer )
oznam( "FTP Connect/Chyba : Nepodarilo sa pripojiť na FTP server: " + cServer )
pripftpok2:=.F.
else
* oznam("FTP Connect/Ok : Pripojenie k FTP serveru úspešné: "+cServer)
pripftpok2:=.T.
endif

* login na FTP server menom a heslom, ak nezadané default anonymous
if !oFtp:Login(cUserID, cPassword)
oznam("Login/Chyba : Pripojenie na FTP server "+cServer+" neúspešné")
pripftpok2:=.F.
else
* oznam("Login/Ok : Pripojenie na FTP server "+cserver+" úspešné" )
pripftpok2:=.T.
endif

* Nastavenie cesty na FTP serveri do priečinku pre PDF LV STOT
if !oFtp:SetCurrentDirectory(cPath)
oznam( "Set directory/Chyba : Nepodarilo sa nastaviť/nájsť priečinok na FTP serveri: " + cPath )
else
* oznam( "Set directory/Ok : Nastavenie priečinku na FTP serveri úspešné: " + cPath )
endif

* Pokusné vytvorenie nového priečinku na FTP serveri - works OK
* Create folder - works fine
if !oFtp:CreateDirectory("TESTFTP") // ok toto funguje
oznam( "*** ERROR: Failed to create directory 'TEST'")
endif

* determine current directory, works fine
ftpdirnazov:=oFtp:GetCurrentDirectory()
oznam("Som v priečinku na FTP : "+ftpdirnazov)

* list directory folder on FTP - ??? NOT WORKS ANY, all return NIL
************************************************************************************
ftpdirobsah:=oFtp:Directory()
wtf ftpdirobsah
ftpdirobsah:=oFtp:Directory(cPath)
wtf ftpdirobsah
ftpdirobsah:=oFtp:Directory(cPath, 'LIST')
wtf ftpdirobsah
ftpdirobsah:=oFtp:Directory("*.*")
wtf ftpdirobsah
ftpdirobsah:=oFtp:Directory(cPath+'/'+"*.*")
wtf ftpdirobsah
ftpdirobsah:=oFtp:Directory(cPath+'//'+"*.*")
wtf ftpdirobsah


* Odpojenie od FTP
oFtp:Destroy()

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: FTP Directory

#2 Post by Victorio »

Hi, problem solved,
Problem was with XB2NET.DLL, and his problem with Windows 10 FallCreator bug. I had version from 16.4.2016
I found newer version 3.5.04 from 22.10.2017 which I forget update.
Older version crash with error W2bin wrong parameter, newer work fine.
:dance:

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: FTP Directory

#3 Post by Koverhage »

This version is 5 years old.
Current is Ver 4.2.00 (2022-02-12)
Klaus

Post Reply