Well the situation is as follows:
I dynamically created folders and upload images in it. I have a homepage which displays all the folders. I have an index page which i want to insert in the newly created folders but just change the path to the folder, such that when the user click on the link on the homepage, it displays all the images on the particular folder.

I tried to do it as follows:

$path = "../cuz";
$folder = $_POST['folder'];

if(file_exists($folder))
	{
	print "<b>The folder already exists!!!</b>";
	exit;
	}
if($folder == "")
	{
	print "<b>Please put a folder name!!</b><br><a href='newdir.php'>Back to create directory</a>";
	exit;
	}
else	
	{
	$oldumask = umask(0);
	mkdir("$path/$folder", 0777);
	umask($oldumask);
	print "<b>Directory was successfully created<b><br>";
	//
$fp = fopen("$path/$folder/index.php", "w");

if(!$fp)
{
	echo "File could not be appended!!!";
	exit;
}

$output = "
This is a test 
 $path/$folder";

fwrite($fp, $output);

fclose($fp);

In the new index file i just want to change the path
Any idea how i can do it.
Thanks as usual for your precious help :rolleyes:

    You can write index.php script that displays all images from current directory and then you can use php copy(SOURCE, DESTINATION) function to copy this script to every new directory you create.

    bool copy ( string source, string dest )

      Write a Reply...