last day (14 days later) » 

10:56 AM
0
Q: php ZipArchive addfile not work

ninjaHere's my code <?php error_reporting(-1); ini_set('memory_limit','1G'); $zip = new ZipArchive(); if ($zip->open(__DIR__.'/xxx.zip') === TRUE) { echo __DIR__.'/CPInfo.txt'."\n"; $zip->addFile(__DIR__.'/CPInfo.txt', 'newname.txt'); $x = $zip->close(); var_...

 
you want to add new files to zip folder?
 
yep, I want to add CPInfo.txt to xxx.zip
 
can you re check your ulimit.give it more than that files.
 
open files (-n) 99999 more than files in xxx.zip
 
give other zip file nam and try like yyy.zip?
and tel me xxx.zip file size
 
10:56 AM
original: xxx.zip size is ~40MB, after remove 900 files is ~ 15MB
 
have you tried with yyy.zip file?
ok,have tried with yyy.zip name
 
yep, xxx.zip or yyy.zip or whatever name, same issue
 
is it ok for new file name of zip files?
like yyy.zip
 
it's ok when i remove 900 files from xxx.zip and run script again
i remove file from xxx.zip via 7zip
 
?you want just create a new files to zip xxx.zip? am'i correct?
 
11:01 AM
I want to add CPInfo.txt to xxx.zip.
 
ok.where CPInfo.txt file is there,can you give path of that file
what is 'newname.txt'?
 
/data/yyy/CPInfo.txt and xxx.zip is /data/yyy/xxx.zip
newname.txt is a filename of CpInfo.txt when add to xxx.zip
 
i have given one answer for this example,check answers
test that code and let me know it's working are not?
 
11:23 AM
@ninja have you tried that code?
 

last day (14 days later) »