PHP code example of ijanki / ftp-bundle
1. Go to this page and download the library: Download ijanki/ftp-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ijanki / ftp-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Ijanki\Bundle\FtpBundle\IjankiFtpBundle(),
];
}
php
use Ijanki\Bundle\FtpBundle\Exception\FtpException;
public function indexAction()
{
//...
try {
$ftp = $this->container->get('ijanki_ftp');
$ftp->connect($host);
$ftp->login($username, $password);
$ftp->put($destination_file, $source_file, FTP_BINARY);
} catch (FtpException $e) {
echo 'Error: ', $e->getMessage();
}
//...
}