Hi,

I’ve having bother with a utility I’ve coded within the CI environment
that is used to transfer files (primarily images) from one server to
another. The utility works by logging on to a linux server, traversing
a number of directories and ftp’ing the files to the target machine.

The utility works fine in my development enivironment (WAMP
architecture) when it accesses the remote linux (dedicated) server.
It’s when the utility is executed in the test environemtn it fails. In
this latter case the utility is executed from an Amazon Scalr
environment but still trying to transfer files from the dedicated
linux server.

I’ve entered numerous log messages to see what’s going on. It appears
as if the utility on Scalr environment is accessing the linux server
ok, and changing to the appropriate directories but it doesn’t seem to
be able to see the contents of the directories. All such directories
have 0777 permissions set on them.

Here’s some snippets of code:

// check connection
if ($conn_id && $login_result) {

    // Change directory
    $currentDir = ftp_pwd($conn_id);
    $chdirResult = ftp_chdir($conn_id, $origPropertyId);
    $currentDir = ftp_pwd($conn_id);

    log_message('kdebug', "Current Dir: ".$currentDir);

    if ($chdirResult) {
        log_message('kdebug', "Chdir worked.");
        // get contents of the current directory
        $contents = ftp_nlist($conn_id, ".");

        // process $contents
        log_message('kdebug', "Directory element count: ".count
($contents));
        for ($j = 0; $j < count($contents); $j++) {
            $filename = $contents[$j];
            log_message('kdebug', "Filename: ".$filename);
            if (strcmp($filename, ".") && strcmp($filename, "..") &&
strcmp($filename, "mcith")) {
                $transferResult = ftp_get($conn_id, $photoDir."/".
$filename, $filename, FTP_BINARY);
            }
        }

        // Also get thumbnails
        $chdirResult = ftp_chdir($conn_id, "mcith");

        if ($chdirResult) {
            // get contents of the current directory
            $contents = ftp_nlist($conn_id, ".");

            // process $contents
            for ($j = 0; $j < count($contents); $j++) {
                $filename = $contents[$j];
                log_message('kdebug', "MCITH Filename: ".$filename);
                if (strcmp($filename, ".") && strcmp($filename, ".."))
{
                    $transferResult = ftp_get($conn_id, $photoDir."/
mcith/".$filename, $filename, FTP_BINARY);
                }
            }

            // Return to the parent directory
            ftp_cdup($conn_id);
        }
        ftp_cdup($conn_id);
    } else {
        log_message('kdebug', "Chdir failed!!");
    }

} Any help would be greatly appreciated.

Brian
http://www.rentpro.co.uk/
-- 
You received this message because you are subscribed to the Google Groups 
"scalr-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/scalr-discuss?hl=en.


Reply via email to