Good day experts!
I want to copy a file inside a newly created folder and rename the file but it seems there’s something wrong with codes and I cant figure it out. Here’s my code:
<?php
$name = $_POST["newFileName"];
$folder = mkdir($name);
session_start();
$name = $_POST["newFileName2"];
$file = 'data.php';
$newfile = $folder/$_POST["newFileName2"].'.php';
file_exists($newfile) && die(" <center><br><br><br><br>The Exam name already exists.! Change it! <br><br> <a href='quiz.php'><button>GO BACK</button></a>");
if (!copy($file, $newfile)) {
echo "Failed to create Quiz";
}else {
echo "Created Successfully";
}
?>