dilab does not currently provide support for this item.

7 comments found.

Dear, I need to create or modify a php file and download .zip this class help me?

Sorry, I do not get what you are trying to do here.

Thanks for this downloader class! It has helped me immensely! Easy to understand, yet powerful at the same time! Works great! Highly Recommended!

so glad you liked it.

please rate it. :)

Can this handle remote files?


No, it does not do that.

Regards XD

Hi, I’m not able to open the zip once it’s downloaded. It seems to download the the right size compared to the files I have. But when I try decompressing the zip, I get a CPGZ file instead of a folder.

I was able to solve the problem by adding the following on line 156 below header(Content-Length…. :

//added ob_clean and flush below header    
ob_clean();  flush();

Hi, I don’t think this script should be only compatible on Windows, being related to an OS shouldn’t be an issue at all. This would leave out every Mac users from being able download files if a site uses your script unless they have some program that does it (which i haven’t tested), and this should be warned to CodeCanyon users on your page that it’s only for Windows (Which I’m sure its something you don’t want). If not, that would mean that we should instead warn our users to download a program if they want to download.

It will also be nice if someone tested this on their server and use Mac to see if they have the same problem. I had disabled compression on my server and other settings just incase, but still had the same problem. Chrome and Safari had the same issue with the script on Mac and I was able to fix it with a simple line after a bit of research and had no more issues on those browsers, so I’m sure a workaround exists on FireFox. A website like DatPiff uses this same method of compressing the uploaded songs along extra attachments when a user downloads, but their works on FireFox using the default Archive Utility from Mac, so I’m sure it’s possible. I will try to look into this more and see if I could find a solution. I hope when you have more time, you can also look into it. Thanks.

By the way, I’m using PHP version 5.4.12. Not sure if it has anything to do, but I did notice a fixed bug on 5.4.15 two weeks ago with ZipArchive::AddFile(). I will also update to 5.4.15.

Ok, good news. I guess the ob_clean did the trick for Chrome and Safari but on Firefox somehow it was not working. So I managed to fix the problem with this change on your script:

 header('Content-Disposition: attachment; filename="' . basename($file) . '"');
It’s now working on all my browsers

Thank you very much for your efforts.

Regards XD

Hi this script worked amazing on my old server but now I get this error message and I don’t know why.

Fatal error: Class ‘ZipArchive’ not found in /home/rdx/public_html/apps/stamper/downloader.php on line 249

Is this something that need to be enabled on the server in php.ini or whm?

Please help! Thanks!


Yes. Windows users need to enable php_zip.dll inside of php.ini in order to use these functions. Please read installation on http://www.php.net/manual/en/zip.installation.php

Cheers XD

I’m on a linux server on apache not window or am I misunderstanding?

Linux server is discussed in the link too.

It is a server issue, you will have to install that ZipArchive.

Regards XD

Hi… having problems… I want to zip and download a single folder, with some sub-directory’s and a few odd files. My temporary folder is created successfully, containing all the mentioned components of download file, in the same script prior to calling the class. Trouble is, only some files – not the folders they’re in are added to the zip?

Furthermore, $folderPath seems to have no effect – it’s not referenced in the function or anywhere else as far as I can see…


Unless this is what I’m supposed to use:

$folderPath = ’../folder1/folder2/’ . $someVar .’/temp’; $downloader->setFiles($folderPath);

But again, this creates a zip with some of the files in and without keeping the sub folder structure.

Please help.

So the problem is that the script does not preserve sub directory document tree, and so any files with the same names are over written – hence the missing files. The product description is misleading – certainly, I was led to think that should I define a directory to download, the whole directory, along with the sub folders would be downloaded as a whole – preserving the sub folder document tree.

If that’s what you’re looking for, in the absence of a response from the developer on this issue, to the contrary, I suggest you look elsewhere.

Developer response?


This class takes multiple files from different sources and put them into one folder, and zip it as a downloadable file.

You are right, it does not preserve any folder tree structure. This is due to the how it works, it takes from multiple sources to one single one level zip file.

I would say it serves as a simple purpose.

Regards XD

Right, now that is clear… but you should make this clear on the product description. Had you have done that, I would not have purchased as your script is no better than many free scripts available online or those already on my system.

Your product description is unclear but it is reasonable to assume that the document tree will be preserved.

But what you say is not quite right… the files are not placed in a folder, they are zipped as is – individual items, not contained in any folder.