Welcome Guest, Not a member yet? Register   Sign In
Problems with FTP on linux
#1

[eluser]Maranax[/eluser]
:gulp:

Hi guys!

I use CI as command string. The code is:

Code:
function run_ftp()
    {
        $config['hostname'] = 'ftp.something';
        $config['username'] = 'username';
        $config['password'] = 'password';
        $config['port']     = '21';
        $config['passive']  = FALSE;
        $config['debug']    = TRUE;
        
        $this->load->library('ftp');

        $this->ftp->connect($config);
        
        $list = $this->ftp->list_files('/data/folder/');

        $i = 1;
        $file_need = '';
        
        foreach($list as $file)
        {
            if(substr($file, -3) == '.gz')
            {
                $file_date = substr($file, -9, 6);

                if($file_date > $this->file_date_sample)
                {
                    $file_need = $file;
                }
            }
            
            $i += 1;
        }
        echo $file_need;
                
        $this->ftp->close();
            
    }

So, this code works perfectly on Windows machine. But if I run it on Linux box it returns the error message:

Quote:<p>Severity: Warning</p>
<p>Message: Invalid argument supplied for foreach()</p>
<p>Filename: controllers/balin_ftp.php</p>
<p>Line Number: 31</p>

Line 31 is "foreach($list as $file)"

I assume that $list is not an array. But why?
Any help is appreciated.


Messages In This Thread
Problems with FTP on linux - by El Forum - 05-26-2010, 10:28 AM
Problems with FTP on linux - by El Forum - 05-26-2010, 11:39 AM
Problems with FTP on linux - by El Forum - 05-26-2010, 11:45 AM
Problems with FTP on linux - by El Forum - 05-26-2010, 11:55 AM
Problems with FTP on linux - by El Forum - 05-26-2010, 12:02 PM
Problems with FTP on linux - by El Forum - 05-26-2010, 12:04 PM
Problems with FTP on linux - by El Forum - 05-26-2010, 12:07 PM
Problems with FTP on linux - by El Forum - 05-26-2010, 12:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB