Hey, I’m new here
Anyway i’ve had this problem for a while. Part of the code is that I’m writing a script that creates a random directory name and makes it. I’ve successfully done that part but it need to put the index.php file into the newly created directory. Heres my directory.
localost/tdir/random number like “83753”
Here is my code.
[php]
<?php $dir = rand(1, 1999999); if (!file_exists($dir)) { mkdir($dir, 0777, true); } if ($dir == true) { echo "Created directory! :D"; } else { echo "Failed to create directory! ~ :("; } echo "Go Back"; echo "Go to page!"; $my_file = 'tdir/myfile/file.php'; $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); $data = 'This is the data'; fwrite($handle, $data); ?> [/php]I’ve got the part of creating the a file called file.php but it stays in the /tdir/ directory and I need to move it to the “83753” directory or the $dir name and rename the file.php file. Thanks