FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » problem in creating Zip file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
problem in creating Zip file [message #178808] Wed, 08 August 2012 06:40 Go to previous message
Supriya is currently offline  Supriya
Messages: 2
Registered: August 2012
Karma:
Junior Member
Hi All
i m trying to create a Zip file of 1 folder which contains 2 folders and 33 files but the resulted zip file only contains 21 file and 1 folder.And when i open the files of zip folder it says files r corrupted.

Here is my code:
Plz help me to find out what is wrong there...

<?php

include("variable.php");

ini_set("max_execution_time", 18000);


// create object

$zip = new ZipArchive();

// open archive

if ($zip->open($outputfoldername . ".zip", ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}

// initialize an iterator
// pass it the directory to be processed

$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($outputfoldername . "/"));

// iterate over the directory
// add each file found to the archive

foreach ($iterator as $key=>$value) {
$zip->addFile(realpath($key), $key) or die ("ERROR: Could not add file: $key");
}

// close and save archive

$zip->close();
echo "Archive created successfully.";
?>

Thanks
Regards Supriya
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to make Apache to allow an executable to leave a file?
Next Topic: PHP Debugger which can set breakpoint and view variables on watch window
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 04:41:01 GMT 2024

Total time taken to generate the page: 0.05086 seconds