note 57630 deleted from function.ftp-chmod by bjori
| From: | bjori@php.net | Date: | Tue, 23 May 2006 13:43:34 +0000 |
| Subject: | note 57630 deleted from function.ftp-chmod by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-111871@lists.php.net to get a copy of this message | ||
Note Submitter: hardy add mapscene dot com
----
//php4 equivalent of the php5 function
if (!function_exists('ftp_chmod')) {
function ftp_chmod($ftpstream,$chmod,$file)
{
$old=error_reporting();//save old
error_reporting(0);//set to none
$result=ftp_site($ftpstream, "CHMOD ".$chmod." ".$file);
error_reporting($old);//reset to old
return $result;//will result TRUE or FALSE
}
}
//demonstration of the function
$ftp_ip="yourserverip";
$ftp_login="theuser";
$ftp_pass="thepassword";
$ftp_file="test.txt";
$conn_id=ftp_connect($ftp_ip);
$login_result=@ftp_login($conn_id, $ftp_login, $ftp_pass);
if(ftp_chmod($conn_id,"0775",$ftp_file)==FALSE)print"ERROR FTP_CHMOD: can't
change chmod of $ftp_file";
ftp_quit($conn_id);