I need to download images from other websites to my server. Create a ZIP file with those images. automatically start download of created ZIP file. once download is complete the ZIP file and images should be deleted from my server.
Instead of automatic download, a download link is also fine. but other logic remains same.
zip files once they've been extracted, so delete them to recover the storage space. Some installers are delivered as . zip files and must be uncompressed first. On Windows, you can access the files inside while they're still compressed.
Select entries in the main WinZip window, right click on any selected file, and click Delete from the shortcut menu. WinZip will display one of two confirmation windows, depending on which view you are using. Default view: WinZip will ask for confirmation that you want to delete the selected files/folders.
Well, you'll have to first create the zipfile, using the ZipArchive
class.
Then, send :
header()
-- there is an example on that manual's page that should helpreadfile()
And, finally, delete the zip file from your server, using unlink()
.
Note : as a security precaution, it might be wise to have a PHP script running automatically (by crontab, typically), that would delete the old zip files in your temporary directory.
This just in case your normal PHP script is, sometimes, interrupted, and doesn't delete the temporary file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With