You are here: FTP fails even though the warning says successful? « All PHP « IT news, forums, messages
FTP fails even though the warning says successful?

Posted by laredotornado on 09/22/06 21:39

Hi,

I'm using PHP 4.4.4 with Apache 2 on Fedora Core 5. I can use a normal
FTP client to successfully reach an FTP server, but when I execute the
following code, I fail with this error

Warning: ftp_put() [function.ftp-put]: Failed to establish connection.
in /usr/local/apache2/htdocs/super_admin_rs/sa_prod_fns.php on line 96
FTP upload has failed!

Here's the code

// set up basic connection
$conn_id = ftp_connect($ftp_host);
if ($conn_id) {
// login with username and password
$login_result = ftp_login($conn_id,
$ftp_user, $ftp_pwd);
if ($login_result) {
// Disable passive mode
ftp_pasv($conn_id, false);

// upload the file
$remote_path = "$ftp_dir/" .
SQL_PRODUCT_SHORT_FILE_NAME;
ftp_delete($conn_id,
$remote_path);
$upload = ftp_put($conn_id,
$remote_path, $sql_file_path, FTP_ASCII);

// check upload status
if (!$upload) {
die("FTP upload has
failed!");
}

What am I doing wrong?

Thanks, - Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация