note 73147 added to function.chmod

From: Date: Sat, 10 Feb 2007 16:05:01 +0000
Subject: note 73147 added to function.chmod
Groups: php.notes 
Request: Send a blank email to php-notes+get-123220@lists.php.net to get a copy of this message
Here's a version that works with PHP 5.x - I use this to watermark images on a shared server. <?php // Connect to the FTP to chmod the file via FTP $ftpUserName = 'username'; $ftpUserPass = 'userpass'; $ftpServer = 'ftp.example.com'; $ftpConn = ftp_connect($ftpServer); if (!$ftpConn) { die("Unable to connect to $ftpServer"); } if (@ftp_login($conn_id, $ftpUserName, $ftpUserPass)) { echo "Connected as $ftpUserName @ $ftpServer"; } else { echo "Couldn't connect as $ftpUserName"; ftp_close($ftpConn); die("Closed connection to $ftpServer"); } //Now change permissions to 666 or whatever you need echo ftp_chmod($ftpConn, 0666, $ftpFilename) ? "CHMOD successful!" : 'Error'; // do what you need here //Now change permissions back to 644 or whatever echo ftp_chmod($ftpConn, 0644, $ftpFilename) ? "CHMOD successful!" : 'Error'; // Close the connection ftp_close($conn_id); ?> ---- Server IP: 64.71.164.2 Probable Submitter: 216.171.248.4 ---- Manual Page -- http://www.php.net/manual/en/function.chmod.php Edit -- https://master.php.net/note/edit/73147 Del: integrated -- https://master.php.net/note/delete/73147/integrated Del: useless -- https://master.php.net/note/delete/73147/useless Del: bad code -- https://master.php.net/note/delete/73147/bad+code Del: spam -- https://master.php.net/note/delete/73147/spam Del: non-english -- https://master.php.net/note/delete/73147/non-english Del: in docs -- https://master.php.net/note/delete/73147/in+docs Del: other reasons-- https://master.php.net/note/delete/73147 Reject -- https://master.php.net/note/reject/73147 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123220) next »