Hi there
i need help... I have created the code to read root files but my code is not reading the folder... i m calling recursive function but don;t know how t o stop this recursive calling process
/****************my code is ***************************/
function make_zip($maindir,$ProjectName,$zipfile)
{
$Directory=$maindir."/".$ProjectName;
$DirectoryHandle = @opendir($Directory) or die("<p><center><h3>you have not been created site yet! please create the site first to download.</h3></center></p>");
while($DirectoryEntry = readdir($DirectoryHandle))
{
$dir = "$Directory/$DirectoryEntry";
if (is_dir($DirectoryEntry)||(!strrpos($DirectoryEntry, "."))) {
$i++;
if($zipfile -> filecounter($dir)<1)
$zipfile -> add_dir($DirectoryEntry);
else
{
$zipfile -> add_dir($DirectoryEntry);
$zipfile ->make_zip($maindir,"$ProjectName/$DirectoryEntry",$zipfile);
}
} elseif (strrpos($DirectoryEntry, ".")&&($DirectoryEntry != "..") && ($DirectoryEntry != ".") && (substr(strtolower($DirectoryEntry), strrpos($DirectoryEntry, ".")+1)))
{

$fname=$DirectoryEntry;
echo "$ProjectName/$fname<br>";
$filename = $Directory."/".$fname;
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
$filedata = $contents;
$zipfile -> add_file($filedata, "$ProjectName/$fname");
fclose($handle);

}
}
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=$ProjectName.zip");
echo $zipfile -> file();
}

please help me how can i Zip the folder having unlimited folders and files
thanks and regards,
Usman