$zipfile->add_dir($dir_company_name . "/"); for ($i_loop = 0; $i_loop < count($myLicenceFileArray); $i_loop++) { $filedata = func_read_file("../gateway/" . $_SESSION['gw_folder'] . "UserDocuments/License/" . $myLicenceFileArray[$i_loop]); $zipfile->add_file($filedata, $dir_company_name . "/License_" . $myLicenceFileArray[$i_loop]); } } if (count($myProfessionalReferenceFileArray) > 0) { $zipfile->add_dir($dir_company_name . "/"); for ($i_loop = 0; $i_loop < count($myProfessionalReferenceFileArray); $i_loop++) { $filedata = func_read_file("../gateway/" . $_SESSION['gw_folder'] . "UserDocuments/Professional_Reference/" . $myProfessionalReferenceFileArray[$i_loop]); $zipfile->add_file($filedata, $dir_company_name . "/Professional_Reference_" . $myProfessionalReferenceFileArray[$i_loop]); } } } } if ($zipfile->get_file_size() > 0) { //$arr_result = func_send_documents($zipfile, $str_company_name, $other_email, $str_failure_companies, //$i_max_file_size_MB, $error_msg); //$zip_file_name = func_replace_invalid_literals($str_company_name); $zip_file_name = "Documents"; $filename = "csv/" . $zip_file_name . ".zip"; $fd = fopen($filename, "wb"); $out = fwrite($fd, $zipfile->file()); fclose($fd); $mail_response = "<a href='csv/Documents.zip' target='_blank'>Click here to Download the documents</a>"; } else { $mail_response = "No Documents to Download"; } function getDirList($dirName, $i_company) { $d = dir($dirName); $filename = "";