$files = "upload/".array('Dear GP.docx','ecommerce.doc');
Must be:
$files = array('upload/Dear GP.docx','upload/ecommerce.doc');
If you still have problems, you should check to see if you have write permissions to the current directory. You can check the return value of close() to see if the file was actually written.
$res = $zip->close(); var_dump($res);
The output should be bool(true) if recording is successful.
It looks like you have the wrong var name in the filesize() call:
header('Content-Length: ' . filesize($zipfilename));
Must be:
header('Content-Length: ' . filesize($zipname));
You can also add an additional check to check if the files you add to the zip exist and check if the mail file exists before sending.
Edit: enable display errors to help you debug locally:
ini_set('display_errors', 1); error_reporting(E_ALL);
source share