From 9e774ad7989f7fea33312407a8e25a2724f2ce8b Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 27 Oct 2006 21:58:04 +0000 Subject: --- user_guide/libraries/ftp.html | 71 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 15 deletions(-) (limited to 'user_guide') 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

FTP Class

-

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.

+

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.

+ +

Note:  SFTP and SSL FTP protocols are not supported, only standard FTP.

Initializing the Class

@@ -176,10 +178,6 @@ array in that file. Then save the file at config/ftp.php and it will -

$this->ftp->sconnect()

- -

Secure FTP connect. This function is identical to the function above, except that it initiates a secure connection.

-

$this->ftp->upload()

@@ -195,26 +193,46 @@ Example:

Permissions are available if you are running PHP 5 and can be passed as an octal value in the fourth parameter.

-

$this->ftp->mkdir()

+

$this->ftp->rename()

+

Permits you to rename a file. Supply the source file name/path and the new file name/path.

+ + +// Renames green.html to blue.html
+$this->ftp->rename('/public_html/foo/green.html', '/public_html/foo/blue.html'); +
-

Lets you create a directory on your server. Supply the path ending in the folder name you wish to create, with a trailing slash:

+

$this->ftp->move()

+

Lets you move a file. Supply the source and destination paths:

-// Creates a folder named "bar"
-$this->ftp->mkdir('/public_html/foo/bar/'); +// Moves blog.html from "joe" to "fred"
+$this->ftp->move('/public_html/joe/blog.html', '/public_html/fred/blog.html');
+

Note: if the destination file name is different the file will be renamed.

-

$this->ftp->chmod()

-

Permits you to set file permissions. Supply the path to the file or folder you wish to alter permissions on:

+

$this->ftp->delete_file()

+

Lets you delete a file. Supply the source path with the file name.

-// Chmod "bar" to 777
-$this->ftp->chmod('/public_html/foo/bar/', 0777); +$this->ftp->delete_file('/public_html/joe/blog.html'); +
+ + +

$this->ftp->delete_dir()

+

Lets you delete a directory and everything it contains. Supply the source path to the directory with a trailing slash.

+ +

Important  Be VERY careful with this function. It will recursively delete +everything within the supplied path, including sub-folders and all files. Make absolutely sure your path is correct. +Try using the list_files() function first to verify that your path is correct.

+ + +$this->ftp->delete_dir('/public_html/path/to/folder/'); +

$this->ftp->list_files()

Permits you to retrieve a list of files on your server returned as an array. You must supply the path to the desired directory.

@@ -228,7 +246,7 @@ print_r($list);

$this->ftp->mirror()

-

Recursively reads a folder and everything it contains (including sub-folders) and creates a +

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:

@@ -238,6 +256,29 @@ $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/'); +

$this->ftp->mkdir()

+ +

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 octal value in the second parameter (if you are running PHP 5).

+ + +// Creates a folder named "bar"
+$this->ftp->mkdir('/public_html/foo/bar/', 0777); +
+ + +

$this->ftp->chmod()

+ +

Permits you to set file permissions. Supply the path to the file or folder you wish to alter permissions on:

+ + +// Chmod "bar" to 777
+$this->ftp->chmod('/public_html/foo/bar/', 0777); +
+ + + +

$this->ftp->close();

Closes the connection to your server. It's recommended that you use this when you are finished uploading.

-- cgit v1.2.3-24-g4f1b