It may seem a little obvious to some but it was an oversight on my behalf.
If you are adding files to the zip file that you want to be deleted make sure you delete AFTER you call the close() function.
If the files added to the object aren't available at save time the zip file will not be created.
ZipArchive::close
(PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
ZipArchive::close — Close the active archive (opened or newly created)
설명
bool ZipArchive::close
( void
)
Close opened or created archive and save changes. This method is automatically called at the end of the script.
인수
이 함수는 인수가 없습니다.
반환값
성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.
ZipArchive::close
jared at kippage dot com
03-Sep-2009 10:08
03-Sep-2009 10:08
gilthans at gmail dot com
23-Oct-2007 03:16
23-Oct-2007 03:16
Don't forget to check the zip isn't empty, folks - otherwise the zip won't be created at all, and the server will issue no warning!
I used a certain loop to add files to the zip, and struggled with permissions and documentation for hours before I realize the loop ended up adding no file, even though addFile WAS called, but on a non-existent file.
This might be the reason your zips aren't popping up.
