Sign in to follow this  
Followers 0
darkjohn20

_FTP_ListToArray() can't find files?

3 posts in this topic

#1 ·  Posted (edited)

Alright, so recently I've been working with FTP. Since I can't test my FTP scripts due to the fact that my server is on the same computer, I signed up for a free online FTP server (maytech.net).

I've been able to successfully connect to my FTP Server, but when I try to list the files to an array, the return value isn't an array (meaning it failed). I'm not sure what's causing this problem...

My script (trimmed quite a bit):

#include <FTPEx.au3>
#include <Array.au3>

Global $ftpServer = "myselectedname.ftpstream.com"
Global $ftpUsername = ""
Global $ftpPassword = ""

$ftpOpen = _FTP_Open("FTP Control")
$ftpConnect = _FTP_Connect($ftpOpen, $ftpServer, $ftpUsername, $ftpPassword)

$Remote_List = _Ftp_ListToArray($ftpConnect, 0)
_FTP_GetLastResponseInfo($dwError, $szMessage)
ConsoleWrite("Error: " & $dwError & @CRLF & "Message: " & $szMessage & @CRLF)
_ArrayDisplay($Remote_List)

_FTP_Close($ftpOpen)

In the Console, the following is written:

Error: 0
Message: 200 PORT command successful

Side note: I can work with files and folders just fine with the FileZilla Client. I can download as well as upload just fine.

Edited by darkjohn20

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Alright, so recently I've been working with FTP. Since I can't test my FTP scripts due to the fact that my server is on the same computer, I signed up for a free online FTP server (maytech.net).

I've been able to successfully connect to my FTP Server, but when I try to list the files to an array, the return value isn't an array (meaning it failed). I'm not sure what's causing this problem...

My script (trimmed quite a bit):

#include <FTPEx.au3>
#include <Array.au3>

Global $ftpServer = "myselectedname.ftpstream.com"
Global $ftpUsername = ""
Global $ftpPassword = ""

$ftpOpen = _FTP_Open("FTP Control")
$ftpConnect = _FTP_Connect($ftpOpen, $ftpServer, $ftpUsername, $ftpPassword)

$Remote_List = _Ftp_ListToArray($ftpConnect, 0)
_FTP_GetLastResponseInfo($dwError, $szMessage)
ConsoleWrite("Error: " & $dwError & @CRLF & "Message: " & $szMessage & @CRLF)
_ArrayDisplay($Remote_List)

_FTP_Close($ftpOpen)

In the Console, the following is written:

Error: 0
Message: 200 PORT command successful

Side note: I can work with files and folders just fine with the FileZilla Client. I can download as well as upload just fine.

Maybe you should add PASSIVE FLAG ==> $i_Passive = 1

This code works successfully I tested

#include <FTPEx.au3>
#Include <Array.au3>

$server = 'myselectedname.ftpstream.com'
$username = ''
$pass = ''
Dim $dwError , $szMessage
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass,1,21)
_FTP_GetLastResponseInfo($dwError, $szMessage)
ConsoleWrite("Error: " & $dwError & @CRLF & "Message: " & $szMessage & @CRLF)
$aFile = _FTP_ListToArray($Conn, 2)
_ArrayDisplay($aFile,"")
$Ftpc = _FTP_Close($Open)
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Thanks. It worked perfectly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0