I want to download some file from FTP Server using FTP Class that already in CodeIgniter, but i get error ftp_get() failed to open stream : permission denied when i called my code. anyone can help me, please ?
this is my code
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class C_FTP extends CI_Controller
{
public function openfile($fileName)
{
$this->load->library('ftp');
$config['hostname'] = 'ftp_host';
$config['username'] = 'ftp_username';
$config['password'] = 'ftp_password';
$config['port'] = 'ftp_port';
$config['debug'] = FALSE;
$config['passive'] = FALSE;
$this->ftp->connect($config);
$this->ftp->download('path/to/folder/', 'local/path', 'auto');
$this->ftp->close();
}}
?>
and my ci version is : 2.2.0
I have found the solution of my problem, just add header before you download the file this my code :
before
change with this