howdy, can't get it done!
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FTP Download</title>
</head>
<body>
<?php
set_time_limit(300);//for setting
$path='/userupload';
$ftp_server='202. …';
$ftp_server_port="21";
$ftp_user_name='al…';
$ftp_user_pass="mypassword";
// set up a connection to ftp server
$conn_id = ftp_connect($ftp_server, $ftp_server_port);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection and login result
if ((!$conn_id) || (!$login_result)) {
echo "Fail</br>";
} else {
echo "Success</br>";
// enabling passive mode
ftp_pasv( $conn_id, true );
// get contents of the current directory
$contents = ftp_nlist($conn_id, $path);
// output $contents
var_dump($contents);
}
// close the FTP connection
ftp_close($conn_id);
?>
</body>
</html>
any idea what I'm doing wrong? it always returns "Success bool(false)"! So the connection is working, however the files won't get listed. Any ideas?
regards