Jump to content


Photo

php HELP


  • Please log in to reply
3 replies to this topic

#1 toter

toter
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 14 October 2006 - 06:50 PM

I am trying to copy a file using the copy function and when the page is loaded the coppied file is blank?

<?php
// set up basic connection
$ftp_server = "<host>";
$conn_id = ftp_connect($ftp_server);

// login with username and password
$ftp_user_name = "<username>";
$ftp_user_pass = "<password>";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// get contents of the current directory
$path = $_SERVER['REQUEST_URI'];
$path = "public_html" . $path;
$contents = ftp_nlist($conn_id, $path);

// Create Folder if user wants to
if($_POST['action'] == 'Create'){

	$dir_name = $path . $_POST['dir_name'] . '/';
	ftp_mkdir($conn_id, $dir_name);
	$template_file = 'ftp://<username>:<password>@<host>/path/to/index.php';
	$index_file =  'ftp://<username>:<password>@<host>/' . $dir_name . 'index.php';
	copy($template_file,$index_file);
}
?>

thanks,
TT

#2 eswginger

eswginger
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 October 2006 - 03:29 PM

bump

#3 toter

toter
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 19 October 2006 - 03:39 PM

i am also having trouble with this simple bit of code:
<?php
copy('file.php','newfile.php');
?>
i get an error of this:

Warning: copy(newfile.php): failed to open stream: Permission denied in /home/<username>/public_html/leaders/tod/copy.php on line 2

but all my files and folders permissions are set to 777

any body know?

thanks a bunch,
TT

#4 toter

toter
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 20 October 2006 - 02:28 AM

bump




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users