FTP-directory

User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

FTP-directory

Post by Dietmar Jahnel »

I'm trying to read the files from a ftp-server.

I modified the ftpdir-sample and always get "oFTP:hFTP is null"
both oInternet:hWinINet and oInternet:hSession are empty

Am I doing something wrong or is it a Vista-related problem?
Many thanks for help,
Dietmar



function Main()

local oInternet := TInternet():New()
// local oFTP := TFTP():New( "207.46.133.140", oInternet ) //
local oFTP := TFTP():New( "ftp://ftp.ourserver.at/", oInternet )

local aFiles

if ! Empty( oFTP:hFTP )
aFiles = oFTP:Directory( "*.*" )
AEval( aFiles, { | aFile | MsgInfo( aFile[ 1 ] ) } )
else
MsgAlert( "oFTP:hFTP is null" )
endif

oInternet:End()

MsgInfo( "Done!" )

return nil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

Just change this line in your code and its working fine (tested on Vista):

local oFTP := TFTP():New( "ftp.microsoft.com", oInternet )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

Antonio,

I tried this sample on two PCs - the result is always "oFTP:hFTP is null"

How can I find out what the problem is?

Thanks (again) for help,
Dietmar
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

Can you connect to ftp.microsoft.com from the Internet Explorer ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

yes I can connect to ftp://ftp.microsoft.com/ from Internet Explorer.

Dietmar
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

Here I run Vista as Administrator, please try it as Administrator to see if that makes a difference, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

It does not make a difference.
I tried on a PC with WindowsXP in a different environment - same result.
I built the sample with xHB RC16 and FWH 7.05

On my vistaPCs its only me with all the rights possible.

Must be something else...
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

I email you my EXE built using FWH 7.07 and Borland. Please try it there, thanks
Last edited by Antonio Linares on Tue Aug 14, 2007 8:08 am, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

I am getting the message "oFTP:hFTP is null" here too (actually oFTP:hFTP is equal to zero). I am using FWH 7.05, Borland, and XP Pro SP2. I have administrator rights.

James
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

Antonio,

your exe is working here as well!
any idea how to solve the problem?

Thank,
Dietmar
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

James,

Please try it with FWH 7.07, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

Solved. Try it this way:

Code: Select all

#include "FiveWin.ch"

function Main() 

local oInternet := TInternet():New() 
local oFTP := TFTP():New( "ftp.microsoft.com", oInternet ) 
local aFiles 

if ! Empty( oFTP:hFTP ) 
aFiles = oFTP:Directory( "*.*" ) 
AEval( aFiles, { | aFile | MsgInfo( aFile[ 1 ] ) } ) 
else 
MsgAlert( "oFTP:hFTP is null" ) 
endif 

oInternet:End() 

MsgInfo( "Done!" ) 

return nil

DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
                             n4 AS DWORD ) AS LONG PASCAL ;
                             FROM "InternetOpenA" LIB "wininet.dll"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

now it' working fine!

many thanks!
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

glad to know its fine :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

Sorry, but now I have another problem:

I need to read the file name and put it in a text file using:

Code: Select all

oText := TTxtFile():New( datei )

FOR x = 1 to len(aSpringer)
   oText:Add(aSpringer[x,1])
NEXT
that' s the result:

JBl_E-2006-643-647-VfGH.pdf ÿÿÿÿ ¸ò ˜ò œò ´ò , ò à“" ø“" è ØÝ ØÝ I " "\à P‘ @} N N EEEE T R O O N N N I C SS

230-N NN E T R O O N NN I C
JBl_E-2006-647-649-OGH.pdf i o n D y n a m i c F a l s e ] 3 ' &Uà ›
w™­Þ™
T R U S C : \ P ewt’ t’
JBl_E-2006-649-653-OGH.pdf 7-144-Novÿ ûDî Ä P‘ 09:10AM 83386 JBl-2000-145-151-Winkler.pdf
05-02-07 09:10AM 123366 JBl-2000-152-161-Taupitz.pdf
05-02-07 09:10AM 153878 JBl-2000-16-30-Schima.pdf
05-02-07 09

I found some posts about this extra informations, but no solution...
Dietmar
Post Reply