TecTao Posted June 26, 2012 Share Posted June 26, 2012 I can not get the copy() function to work. It is a two step process. First creating a new directory in the root of the web site. This works fine. The new directory name is an ID number for a member. The second step is copying an index.php file from the directory where the page resides that completes this function. The new directory is passed in the post from a previous page and the index.php file resides in the same directory. code where $webpage is the ID passed from the previous page: $webpage = $_POST[ 'webpage' ]; mkdir("/home/thissite/public_html/thisdomain.com/$webpage"); $NewDirectory = $webpage; copy('index.php', '/home/thissite/public_html/thisdomain.com/$NewDirectory/index.php'); error_reporting(E_ALL | E_STRICT); I can't really make head or tails of what the error log indicates [26-Jun-2012 11:49:53] PHP Warning: copy(/home/zipclick/public_html/marketingteammates.com/$NewDirectory/index.php) [<a href='function.copy'>function.copy</a>]: failed to open stream: No such file or directory in /home/zipclick/public_html/marketingteammates.com/_ZABP_merchants/webpage/webpage_enter_submitted.php on line 23 Any ideas are greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/264820-problems-copying-file-to-a-newly-created-directory/ Share on other sites More sharing options...
Pikachu2000 Posted June 26, 2012 Share Posted June 26, 2012 Look at the syntax highlighting of your copy() arguments. Variables are not interpolated within single quotes. Link to comment https://forums.phpfreaks.com/topic/264820-problems-copying-file-to-a-newly-created-directory/#findComment-1357134 Share on other sites More sharing options...
TecTao Posted June 26, 2012 Author Share Posted June 26, 2012 Thanks for pointing that out. changed code is now copy("index.php", "/home/zipclick/public_html/marketingteammates.com/". $NewDirectory ."/index.php"); works fine. Thanks Link to comment https://forums.phpfreaks.com/topic/264820-problems-copying-file-to-a-newly-created-directory/#findComment-1357138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.