Improved FTP Class |
[eluser]Phil Sturgeon[/eluser]
I recently made a class takes config "groups" just like the database config. I used this as I wanted to be able to connect to various different servers within the same file without having to enter the config arrays many times. /application/config/Ftp.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /application/libraries/MY_Ftp.php Code on Pastebin for now The benefits of this are that it can be used EXACTLY like the old FTP library, with some added usefulness with the multiple connection types, and obviously saves on repeated code. You can pass it custom config variables, or simply the name of one of your groups like so: Code: $this->ftp->connect('media_server'); $this->ftp->move('public_html/local/file.png', 'public_html/remote/file.png'); It also supports FTP SSL connections. For error messages to be able to show, you will need to add the line below to your ftp lang file. Code: // Custom Please test it and let me know how it goes. If it works ok then i'll put it on the Wiki. |
Messages In This Thread |
Improved FTP Class - by El Forum - 07-29-2007, 10:30 AM
Improved FTP Class - by El Forum - 07-29-2007, 11:10 AM
Improved FTP Class - by El Forum - 07-30-2007, 03:40 AM
Improved FTP Class - by El Forum - 08-04-2007, 01:17 PM
Improved FTP Class - by El Forum - 10-10-2008, 04:57 PM
Improved FTP Class - by El Forum - 01-08-2009, 07:06 AM
|