GFtp is a FTP extension for YII Framework.
It contains :
GFtpComponent
: A component used to manage FTP connection and navigation (encapsulates PHP ftp method).GFtpApplicationComponent
: An application component that wraps FTP component.GFtpWidget
: A widget which can be used to display FTP folder content and allow FTP server browsing.
As many YII extension, you have to unzip archive under a subfolder of your extensions folder.
Subfolder must be named GFtp.
Here is a basic usage of GFtp extension. More samples could be found on GFtp extension website.
- Create an FTP application component
return array(
// [...]
'components'=>array(
// [...]
'ftp' => array(
'class' => 'ext.GFtp.GFtpApplicationComponent',
'connectionString' => 'ftp://user:pass@host:21',
'timeout' => 120,
'passive' => false
)
),
// [...]
);
- Create a local FTP component
Yii::import('ext.GFtp.GFtpComponent')
$gftp = Yii::createComponent('ext.GFtp.GFtpComponent', array(
'connectionString' => 'ftp://user:pass@host:21',
'timeout' => 120,
'passive' => false)
);
- Use component
$files = $gftp->ls();
$gftp->chdir('images');