zipping file problem on the server PHP
Posted
by Ahmet vardar
on Stack Overflow
See other posts from Stack Overflow
or by Ahmet vardar
Published on 2010-04-22T14:00:26Z
Indexed on
2010/04/22
14:03 UTC
Read the original article
Hit count: 171
php
Hi,
here is my code;
error_reporting(-1);
require("zip_min.php");
$f = $_SERVER['DOCUMENT_ROOT'] ."/mp3/allmp3s.zip";
if (!file_exists($f)) {
$zipfile = new zipfile();
$folder = $_SERVER['DOCUMENT_ROOT'] ."/mp3;
if (is_dir($folder)) {
if($dir = opendir ($folder)) {
while (false !== ($file = readdir($dir))) {
if($file != ".") {
if($file != "..") {
$zipfile -> addFile(file_get_contents($folder."/".$file), $file);
}
}
}
closedir($dir);
$contents = $zipfile -> file();
if (file_put_contents($f, $contents)) {
print "ok";
} else {
print "error creating file";
}
}
} else {
print "error";
}
} else {
print "file already exists";
}
there are 10 mp3 files total size of 100 mb, when i execute this script, i got just a blank page, nothing happens. but with 30-40 mb of size it works great.
what should i do ?
thanks so much
© Stack Overflow or respective owner