
Asbjorn Grandt - 2012-10-16 18:23:48 -
In reply to message 1 from Sumith Harshan
First, you should avoid ob_start()
Next, have you tried the addDirectoryContent function in Zip?
$zip->addDirectoryContent($realPath, $zipPath, $recursive, $followSymlinks, &$addedFiles);
Only the first two arguments are required.
So from your example I'd say the command is:
$zip->addDirectoryContent($fileDirectory, "");
Arguments:
String $realPath Path on the file system.
String $zipPath Filepath and name to be used in the archive.
bool $recursive Add content recursively, default is TRUE.
bool $followSymlinks Follow and add symbolic links, if they are accessible, default is TRUE.
array &$addedFiles Reference to the added files, this is used to prevent duplicates, default is an empty array.
If you start the function by parsing an array, the array will be populated with the realPath and zipPath kay/value pairs added to the archive by the function.