Jump to content

FTP file Upload Permissions denied headache


kathleennewbie

Recommended Posts

We have spent days at this, searching blogs, and posts across the board, until we found you php freaks... and are hoping someone can resolved this issue.

 

We are copying data from one database to another on the same server, but different accounts. (Centos, WHM, Cpanel)

 

We get errors no matter what we do. FTP chmod on file is 777...

ERROR EXAMPLES

Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/owbrok/public_html/auto_setup_missing.php on line 361
FTP upload of /home/owbrok/public_html/uploads/images/vendor/small/502_header_short.jpg has failed!

Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/owbrok/public_html/auto_setup_missing.php on line 403
FTP upload of /home/owbrok/public_html/uploads/images/vendor/big/502_header_short.jpg has failed!

Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/owbrok/public_html/auto_setup_missing.php on line 447
FTP upload of /home/owbrok/public_html/uploads/images/vendor/big/502_header_short.jpg has failed!

 

CODE EXAMPLES

[code=php:0]// ******************************** START UPLOAD SMALL PHOTO TO REMOTE SITE *******************************//
// ******************************** START UPLOAD SMALL PHOTO TO REMOTE SITE *******************************//
$name = $last_vendor_logo_renamed;
$filename = "/home/owbrok/public_html/uploads/images/vendor/small/".$last_vendor_logo[$iCounterOuter];

//-- Connection Settings
$ftp_server = $db_server[$iMainCounter]; // Address of FTP server.
$ftp_user_name = $ftp_user[$iMainCounter]; // Username
$ftp_user_pass = $ftp_pass[$iMainCounter]; // Password
$destination_file = "/public_html/uploads/images/vendor/small/"; //where you want to throw the file on the webserver (relative to your login dir)

$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");        // set up basic connection

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die("You do not have access to this ftp server!");   // login with username and password, or give invalid user message
// turn passive mode on
ftp_pasv($conn_id, true);

if ((!$conn_id) || (!$login_result)) {  // check connection
    // wont ever hit this, b/c of the die call on ftp_login
    echo "FTP connection has failed! <br />";
    echo "Attempted to connect to $ftp_server for user $ftp_user_name";
    exit;
} else {
    echo "Connected to $ftp_server, for user $ftp_user_name <br />";
}

$upload = ftp_put($conn_id, $destination_file.$name, $filename, FTP_BINARY);  // upload the file
if (!$upload) {  // check upload status
    echo "FTP upload of $filename has failed!<br />";
} else {
   echo"Uploading SMALL $name Completed Successfully!<br /><br />";
}
ftp_close($conn_id); // close the FTP stream  

// ******************************** END UPLOAD SMALL PHOTO TO REMOTE SITE *******************************//
// ******************************** END UPLOAD SMALL PHOTO TO REMOTE SITE *******************************//

[/code]

Well, not really, it is more like we have the users, they have accounts with a default logo image, and so we are trying to copy those images to a local site on the same server (testing local vs. national models) so it is simply using pHP ftp to copy the file, we rename it and then put it to the new folder for the new local site.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.