<?php
function myftp($ftp_server , $ftp_user_name , $ftp_user_pass , $ftp_is_pasv , $destination_file , $source_file)
{
// connect to the FTP server
$conn_id = ftp_connect($ftp_server);
if(!$conn_id)
{
//echo 'Connect Failed!';
return false;
}
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if(!$login_result)
{
//echo 'Login Failed! ';
return false;
}
if($ftp_is_pasv)
ftp_pasv($conn_id, true); // 开区passive被动模式
else
ftp_pasv($conn_id, false);
if (ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY))
{
return true;
}
else
{
//echo "Cann'n't upload your file!";
return false;
}
ftp_close($conn_id);
}
?>
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交