A2xA Posted January 28, 2008 Share Posted January 28, 2008 Basically I've been overcomplicating things. I've been trying to make a directory and a folder and files at the same time. when I could've just copied the folder and renamed it. I want the users to submit a form that copys a folder and changes the name to what the user submitted into the form. Is this possible would I use makedir() or copy()? Thanks all help is appreciated! Link to comment https://forums.phpfreaks.com/topic/88111-solved-how-to-copy-a-folder-and-change-the-name/ Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 something like this? <?php $dir = $_POST[dir]; $file = 'htp://wiicharged.com/hubchat/hubex'; $newfile = 'htp://wiicharged.com/hubchat/$dir'; ?> the 'dir' being posted in the form before Link to comment https://forums.phpfreaks.com/topic/88111-solved-how-to-copy-a-folder-and-change-the-name/#findComment-450832 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 Okay, I've got a copy code, but it's giving me errors. Someone please Help? :-\ <?php $dir = $_POST[dir]; mkdir("/home/wiicharg/public_html/hubchat/$dir", 0755); chmod("/home/wiicharg/public_html/hubchat/$dir", 0777); $file = 'http://wiicharged.com/hubchat/hubex/shout.php'; $newfile = 'http://wiicharged.com/hubchat/$dir/shout.php'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } $file = 'http://wiicharged.com/hubchat/hubex/shout.swf'; $newfile = 'http://wiicharged.com/hubchat/$dir/shout.swf'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } $file = 'http://wiicharged.com/hubchat/hubex/shout.txt'; $newfile = 'http://wiicharged.com/hubchat/$dir/shout.txt'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/88111-solved-how-to-copy-a-folder-and-change-the-name/#findComment-450844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.