1. I am uploading the module to the webserver.
2. Then in the next step want to ftp same module to backup server.
So Step 1
Code: Select all
$path = "../modules";
if (!is_dir($path))
mkdir($path,0700);
if (!move_uploaded_file($_FILES['srcfile']['tmp_name'], $path."/".strtolower(trim($_FILES['srcfile']['name']))))then Step 2
Code: Select all
$ftp = ftp_connect('server goes here');
// login with username and password
if (ftp_login($ftp, 'username', 'password'))
{
ftp_pasv ( $ftp, true );
if (ftp_put($ftp, "public_html/temp/" . $_FILES['srcfile']['name'], $_FILES['srcfile']['tmp_name'], FTP_BINARY))
{
$message = "File uploaded";
}
else
{
die("Could not upload file");
}
}
else
{
die("Could not login to FTP account");
}
if (!empty($message))
{
echo $message;
}
// close the FTP stream
ftp_close($ftp);The only way this second FTP code works is if I comment out the first upload code,
Code: Select all
$path = "../modules";
if (!is_dir($path))
mkdir($path,0700);
//if (!move_uploaded_file($_FILES['srcfile']['tmp_name'], $path."/".strtolower(trim($_FILES['srcfile']['name']))))Thank you for any help.