Error with connecting ftp through php ...

Posted by Holicreature on Stack Overflow See other posts from Stack Overflow or by Holicreature
Published on 2010-06-14T11:08:19Z Indexed on 2010/06/14 11:12 UTC
Read the original article Hit count: 110

Filed under:
|

Hi,

I'm trying to connect to my server using php script to upload some files...

But it doesn't connect...

I dont know what is the error...

I'm sure that ftp is enable, i checked it through php_info()

What may be the error...

<?php
error_reporting(E_ALL); 
$ftp_server = "server.com";  //address of ftp server (leave out ftp://)
$ftp_user_name = "Username"; // Username
$ftp_user_pass = "Password";   // Password

$conn_id = ftp_connect($ftp_server);        // set up basic connection

$login_result = ftp_login($conn_id,$ftp_user_name,$ftp_user_pass);

if ($login_result = ftp_login($conn_id,$ftp_user_name,$ftp_user_pass)) {
    echo "Connected as ,$ftp_user_name,$ftp_user_pass \n";
} else {
    echo "Couldn't connect \n";
}
.....
.....
....
....
ftp_close($conn_id); // close the FTP stream
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about ftp