note 105006 added to function.ftp-fput
| From: | siblini at hotmail dot co dot uk | Date: | Thu, 21 Jul 2011 20:03:19 +0000 |
| Subject: | note 105006 added to function.ftp-fput | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181767@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 90.222.35.153
----
Manual Page -- http://www.php.net/manual/en/function.ftp-fput.php
Edit -- https://master.php.net/note/edit/105006
Del: integrated -- https://master.php.net/note/delete/105006/integrated
Del: useless -- https://master.php.net/note/delete/105006/useless
Del: bad code -- https://master.php.net/note/delete/105006/bad+code
Del: spam -- https://master.php.net/note/delete/105006/spam
Del: non-english -- https://master.php.net/note/delete/105006/non-english
Del: in docs -- https://master.php.net/note/delete/105006/in+docs
Del: other reasons-- https://master.php.net/note/delete/105006
Reject -- https://master.php.net/note/reject/105006
Search -- https://master.php.net/manage/user-notes.php