note 105006 rejected from function.ftp-fput by danbrown
| From: | danbrown@php.net | Date: | Fri, 22 Jul 2011 15:47:26 +0000 |
| Subject: | note 105006 rejected from function.ftp-fput by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181790@lists.php.net to get a copy of this message | ||
Note Submitter: siblini at hotmail dot co dot uk
----
Hi,
Can some one help me please, I am new into php,
I want to send a file into ftp, I am using this code:
<?php
//Send the FTP Connection and send the Excel file to the ftp server
$ftp_server = "xxxxxx";
$ftp_user = "xxx";
$ftp_pass = "xxx";
$file = 'xls/AB-MXRPayment.xls';
$fp = '/AB-MXRPayment.xls';
// set up a connection or die
$conn_id = ftp_connect($ftp_server , 20 ) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected as $ftp_user@$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
if (@ftp_put($conn_id, $fp, $file, FTP_ASCII)) {
echo "Successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
The problem I am getting is that this code is uploading the file in port 21 server and not in port
20 server.
Youssef