diff options
-rw-r--r-- | user_guide/libraries/ftp.html | 71 |
1 files changed, 56 insertions, 15 deletions
diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index 4df9c545b..1fc82b499 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -63,8 +63,10 @@ FTP Class <h1>FTP Class</h1>
-<p>Code Igniter's FTP Class permits files to be uploaded via FTP to your server. It also includes a "mirroring" function
-that permits an local directory to be recreated remotely via FTP.</p>
+<p>Code Igniter's FTP Class permits files to be uploaded, moved, renamed, and deleted on your server. It also includes a "mirroring" function
+that permits a local directory to be recreated remotely via FTP.</p>
+
+<p class="important"><strong>Note:</strong> SFTP and SSL FTP protocols are not supported, only standard FTP.</p>
<h2>Initializing the Class</h2>
@@ -176,10 +178,6 @@ array in that file. Then save the file at <var>config/ftp.php</var> and it will </ul>
-<h2>$this->ftp->sconnect()</h2>
-
-<p>Secure FTP connect. This function is identical to the function above, except that it initiates a secure connection.</p>
-
<h2>$this->ftp->upload()</h2>
@@ -195,26 +193,46 @@ Example:</p> <p>Permissions are available if you are running PHP 5 and can be passed as an <kbd>octal</kbd> value in the fourth parameter.</p>
-<h2>$this->ftp->mkdir()</h2>
+<h2>$this->ftp->rename()</h2>
+<p>Permits you to rename a file. Supply the source file name/path and the new file name/path.</p>
+
+<code>
+// Renames green.html to blue.html<br />
+$this->ftp->rename('/public_html/foo/green.html', '/public_html/foo/blue.html');
+</code>
-<p>Lets you create a directory on your server. Supply the path ending in the folder name you wish to create, with a trailing slash:</p>
+<h2>$this->ftp->move()</h2>
+<p>Lets you move a file. Supply the source and destination paths:</p>
<code>
-// Creates a folder named "bar"<br />
-$this->ftp->mkdir('/public_html/foo/bar/');
+// Moves blog.html from "joe" to "fred"<br />
+$this->ftp->move('/public_html/joe/blog.html', '/public_html/fred/blog.html');
</code>
+<p>Note: if the destination file name is different the file will be renamed.</p>
-<h2>$this->ftp->chmod()</h2>
-<p>Permits you to set file permissions. Supply the path to the file or folder you wish to alter permissions on:</p>
+<h2>$this->ftp->delete_file()</h2>
+<p>Lets you delete a file. Supply the source path with the file name.</p>
<code>
-// Chmod "bar" to 777<br />
-$this->ftp->chmod('/public_html/foo/bar/', 0777);
+$this->ftp->delete_file('/public_html/joe/blog.html');
+</code>
+
+
+<h2>$this->ftp->delete_dir()</h2>
+<p>Lets you delete a directory and everything it contains. Supply the source path to the directory with a trailing slash.</p>
+
+<p class="important"><strong>Important</strong> Be VERY careful with this function. It will recursively delete
+<b>everything</b> within the supplied path, including sub-folders and all files. Make absolutely sure your path is correct.
+Try using the <kbd>list_files()</kbd> function first to verify that your path is correct.</p>
+
+<code>
+$this->ftp->delete_dir('/public_html/path/to/folder/');
</code>
+
<h2>$this->ftp->list_files()</h2>
<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply
the path to the desired directory.</p>
@@ -228,7 +246,7 @@ print_r($list); <h2>$this->ftp->mirror()</h2>
-<p>Recursively reads a folder and everything it contains (including sub-folders) and creates a
+<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a
mirror via FTP based on it. Whatever the directory structure of the original file path will be recreated on the server.
You must supply a source path and a destination path:</p>
@@ -238,6 +256,29 @@ $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/'); +<h2>$this->ftp->mkdir()</h2>
+
+<p>Lets you create a directory on your server. Supply the path ending in the folder name you wish to create, with a trailing slash.
+Permissions can be set by passed an <kbd>octal</kbd> value in the second parameter (if you are running PHP 5).</p>
+
+<code>
+// Creates a folder named "bar"<br />
+$this->ftp->mkdir('/public_html/foo/bar/', 0777);
+</code>
+
+
+<h2>$this->ftp->chmod()</h2>
+
+<p>Permits you to set file permissions. Supply the path to the file or folder you wish to alter permissions on:</p>
+
+<code>
+// Chmod "bar" to 777<br />
+$this->ftp->chmod('/public_html/foo/bar/', 0777);
+</code>
+
+
+
+
<h2>$this->ftp->close();</h2>
<p>Closes the connection to your server. It's recommended that you use this when you are finished uploading.</p>
|