CuDemVN.Wap.Sh



![]() | ![]() ![]() ![]() |
<?php
function tailenftp($file) {
$fp = fopen($file, 'r');
$server='Tên server ở đây';
$name='Tên đăng nhập';
$pass='Pass';
$thumuc='thư mục up ví dụ /public_html';
//kêt nối server
$conn_id = ftp_connect($server);
// Đăng nhập
$login_result = ftp_login($conn_id, $name, $pass);
$name = explode($thumuc,$file);
$name = $name[count($name)-1];
$name = explode("?",$name);
$name = 'SinhThanh.XtGem.Com-'.$name[0].'';
// upload $file
if(ftp_fput($conn_id,$dir."/".$name,$fp,FTP_BINARY))
{
$thanh='Thành công '.$file.'';
} else {
$thanh='Có lỗi xảy ra trong qua trình up '.$file.'';
}
return $thanh;
}
?>
Để dùng thì gọi function tailenftp ra nhé.
$thanh='http://sinhthanh.xtgem.com/love.zip';
tailenftp($thanh);
Nguồn: SinhThanh

Đánh giá: 4.5/ 5, 573 bình chọn
