Jump to content

Recommended Posts

Can you post the code?  Do you get errors?

 

 

Try this example's format: (PHP.net ftp_connect())

 

$ftp_server = "ftp.example.com";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 

?>

Thanks for the support

Im using the same code from the PHP.NET,

The isuse is that the server doesnt have FTP enabled, do you know how to enable it?

 

when u log into ur control pannel u need to create an ftp account, how do u upload files you must have an ftp server installed otherwise u cant upload files, so use the ftp details u use to upload files to ur server.

function ftp(){
if($sys_local_server == $sys_live_site){ 
			if ($image_size > 0) {
				//Connect
				$ftp_con = ftp_connect($GLOBALS['sys_ftp_server']);
				if(!$ftp_con) echo("Failed to establish an FTP connection.");
				if(!ftp_login($ftp_con, $GLOBALS['sys_ftp_user'], $GLOBALS['sys_ftp_pass'])) echo("Failed to log in to FTP server.");

				//chmod directory
				if(!ftp_site($ftp_con, "CHMOD 0777 "."/".$folder)) echo("Failed to CHMOD directory.");

				//ftp the file
				$ftp_put = ftp_put($ftp_con, $folder."/".$filename, $image_filename, FTP_BINARY);			
				if(!$ftp_put) echo("Failed to FTP transfer file.");;			

				//chmod the file
				if(!ftp_site($ftp_con, "CHMOD 0644 ".$folder."/".$filename)) echo("Failed to reCHMOD directory.");
				//chmod directory back
				if(!ftp_site($ftp_con, "CHMOD 0755 ".$folder)) echo("Failed to reCHMOD directory.");

				if($ftp_put) return true;
				else return false;
			}
			else return false;
		}
}

 

this code can help you determin if you can at least log in, rember youy need to define foilder pass and username, folder will start from var/

Here is the code that Im using for FTP upload

 

function CheckFTPConnection($user_name, $ftp_user_pass){

$conn_id = ftp_connect("");

// Login with username and password

$ftp_user_name = ""

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

ftp_close($conn_id);

if ((!$conn_id) || (!$login_result))

      $returnError = "Error";

    else

  $returnError = "";

// echo $returnError;

return  $returnError;

}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.