Pavel
Pavel

Reputation: 35

Read FTP dir (list) via PHP - error in name

I have a code which read FTP dir with directories with names such as (example):

"John_Trumph_USA_bb44cc"

code:

$dh = opendir("ftp://10.200.1.1/rt");
while($filename = readdir($dh))
{
echo " ".$filename."\n <br>";
?>

But in final result I have only:

"_Trumph_USA_bb44cc"

Where is the first word "John"?

Upvotes: 0

Views: 62

Answers (2)

George Myl
George Myl

Reputation: 301

Try changing the encoding like this.

setlocale(LC_ALL, 'ru_RU');

$dh = opendir("ftp://10.200.1.1/rt");
while($filename = readdir($dh))
{
echo " ".$filename."\n <br>";
?>

Upvotes: 1

DanLewis
DanLewis

Reputation: 102

Sorry, I can't comment so I've had to leave an answer

Have you tried using the example code from the PHP documentation ? The first example here is trying to do exactly what you are.

Upvotes: 0

Related Questions