I am having a problem getting my php script to send a file to another server via FTP. I have Xampp installed on my system and able to run the script no problem. When I add it to my remote server that is running FreeBSD, I get this error :

Warning: ftp_put() [function.ftp-put]: Failed to establish connection.

Here is my script :

$server = "";
$ftp_user_name = "";
$ftp_user_pass = "";
$file = "";
$remote_file = "";

$conn = ftp_connect($server) or die("Could not connect");

// login with username and password
$login_result = ftp_login($conn,$ftp_user_name,$ftp_user_pass) or die('Cannot login');

if (ftp_size($conn,$remote_file) > -1) {;
ftp_delete($conn,$remote_file) or die('Cannot delete');

// upload a file
if (ftp_put($conn, $remote_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file to $server\n";
} else {
echo "There was a problem while uploading $file\n";

// close the connection