tod help (copy function)
| From: | todtot87 at comcast dot net | Date: | Wed, 18 Oct 2006 04:30:45 +0000 |
| Subject: | tod help (copy function) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-243272@lists.php.net to get a copy of this message | ||
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