php zip and download online image

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
howardhee
Forum Newbie
Posts: 1
Joined: Thu Mar 31, 2016 2:01 am

php zip and download online image

Post by howardhee »

Below is my question, how to I solve it?
http://stackoverflow.com/questions/3619 ... 0_36195826

Please help. Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php zip and download online image

Post by Christopher »

You are not created a ZIP file. The code should be:

Code: Select all

        $zip_name = "zipfile.zip";
        $zip = new ZipArchive($zip_name);
Even then, it is not clear where the file will be created. You need to give it a full path like "/tmp/zipfile.zip". Also, you should give the file an unique name so multiple requests do not create the same file at the same time. And delete the file when you are done.
(#10850)
Post Reply