PHP
43
UploadFTP
Guest on 25th April 2022 01:29:06 AM
<?php
class UploadFTP
{
function UploadFTP()
{
}
function uploadMap($map_name, $map_path)
{
$ftp_user_name='localprojects';
$ftp_user_pass='oboe123';
$ftp_server='lemonhead.myhost.com';
$ftp_dir='/maps/';
//$web_location is needed for the file_exists function, the directories used by FTP
//are not visible to it will will always return not found.
$web_dir='/maps/';
$web_location=$web_dir.$map_name;
//build a fully qualified (FTP) path name where the file will reside
$destination_file=$ftp_dir.$map_name;
// connect, login, and transfer the file
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$upload = ftp_put($conn_id, $destination_file, $map_path.$map_name, FTP_BINARY
);
//use ftp_site to change mode of the file
//this will allow it be visible by the world,
$ch=ftp_site($conn_id,"chmod 777 ".$destination_file);
// close the FTP stream
}
}
?>