tod help (copy function)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am having an issue with the copy function.

When I use the php.net specifications with the URLs being relative URLs I get a permission error but all files and folders are set to 777. See Code 1.

If I use an ftp url it works for a few times but eventually I start copying blank pages. See Code 2.

I echo the URLs in the browser and they look fine.

Code 1:

//submit form (post) field dir_name: entered: music

if($_POST['action'] == 'Create'){

	$dir_name = $path . $_POST['dir_name'] . '/';
	ftp_mkdir($conn_id, $dir_name);
	$template_file = $dir . 'temp/index.php';
	$index_file = $_POST['dir_name'] . '/index.php';
	copy($template_file,$index_file);
	echo $template_file;
	echo '<br>';
	echo $index_file;
}

results with:
dir created
error:
Warning: copy(music/index.php): failed to open stream: Permission denied in /home/<username>/public_html/leaders/tod/index.php on line 27


Code 2:

//submit form (post) field dir_name: entered: music

if($_POST['action'] == 'Create'){

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

result with:
dir created

page blank
or
page copied success

echo $template_file; // result: ../temp/index.php
echo '<br>';
echo $index_file; //result: ftp://<username>:<password>@<host>/public_html/leaders/tod/music/index.php

can you tell me why code 1 gives me an error or why code 2 gives blank pages some of the time (my theory for this maybe b/c ftp only allows so many connections).

Thank You,
Tod Toter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux