Welcome Guest, Not a member yet? Register   Sign In
FTP Class: file_exists() does not work
#1

[eluser]WoolyG[/eluser]
Hi all,

Take a look:

Code:
public function cron_download_transaction_data()
    {

    

        $config['hostname'] = 'ip_addr';
        $config['username'] = 'user_name';
        $config['password'] = 'pass';
        $config['debug'] = TRUE;

        $this->ftp->connect($config);

        $list = $this->ftp->list_files('/');

        print_r($list); // /file1.csv and /file2.csv show up here


        $files_array = array('/file1.csv', '/file2.csv');

        foreach($files_array as $file)
        {
            $this->ftp->chmod($file, DIR_WRITE_MODE); // WORKS
            if(file_exists($file))
            {
                if(!$this->ftp->download($file, '/var/www/assets/import/folder1/'.$file, 'ascii', 0775))
                {
                    $details = "ERROR: Could not download $file to local folder ('/var/www/assets/import/folder1/$file').";
                    

                }
            }
            else
            {
                echo "File $file does not exist.";
            }

        }


        $this->ftp->close();
    }

I am able to CHMOD the files, which proves that they exist (I see the permissions changing), but always get "File X does not exist".

Do standard PHP file commands not work with the FTP class?

All input appreciated.
Thanks,
Wooly


Messages In This Thread
FTP Class: file_exists() does not work - by El Forum - 11-27-2012, 05:57 PM
FTP Class: file_exists() does not work - by El Forum - 11-27-2012, 06:10 PM
FTP Class: file_exists() does not work - by El Forum - 11-27-2012, 07:03 PM
FTP Class: file_exists() does not work - by El Forum - 11-28-2012, 09:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB