I am trying to create a directory after a form submit, then after the form is submitted I want that directory to have a file stuffed inside of it. I have tried the php copy function and used an if statement to see if it was copying successfully but it is not. Please take a look at my code and see what is going on. And when it was working, it would just give a "1" output once submitted. No actual file was moved inside of the folder.
if($_POST['submit']=='Register') { // If the Register form has been submitted $root = "/serves/registered.php"; $err = array(); $folder = mkdir($_POST['username']); $reg = "registered.php"; mkdir($_POST['username']); copy($root,$folder); if (!copy($root, $folder)) { echo "failed to copy $root...\n"; } else { echo "Account was successfuly created."; } Thank you
renamefunction. But I don't understand what are you trying to do. Why do youmkdir($_POST['username'])andcopy($root,$folder)twice?