0) { $sconto = new DomandaSconti($id_sconto); if (isset($_POST['type'])) { if ($_POST['type'] == 'biglietto') { $fileName = trim($sconto->FILEPATH_BIGLIETTO); } elseif ($_POST['type'] == 'imbarco') { $fileName = trim($sconto->FILEPATH_CARTAIMBARCO); } } //$istanza = Domanda::loadDomandaFromAccount(); $istanza = new Domanda($sconto->ID_DOMANDA); //$LoggedAccount->checkAuthShowDomandaPage($istanza->ID); $folder = $istanza->generateDirForUpload(ROOT_UPLOAD_PRESENTAZIONE, 'biglietti'); $filePath = $folder . '/' . $fileName; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($filePath)); ob_clean(); flush(); readfile($filePath); exit; } exit; } function downloadFile() { global $LoggedAccount; $id_allegato = intval($_POST['id']); if ($id_allegato > 0) { $allegato = new Allegati($id_allegato); if (isset($_POST['file'])) { $fileName = trim($_POST['file']); } else { $fileName = $allegato->FILEPATH; } $domanda = new Domanda($allegato->ID_DOMANDA); //$LoggedAccount->checkAuthShowDomandaPage($domanda->ID); $documenti_bando = new DocumentiBando($allegato->ID_DOCUMENTO); $pathInfo = $documenti_bando->getPathInfoDocumento(); $folder = $domanda->generateDirForUpload(ROOT_UPLOAD_PRESENTAZIONE, $pathInfo["PATH_DOCUMENTO"]); $filePath = $folder . '/' . $fileName; if (filesize($filePath)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($filePath)); ob_clean(); flush(); readfile($filePath); } else { echo "Il file non esiste!"; } exit; } exit; } function downloadIstanza() { global $LoggedAccount; $response = Utils::initDefaultResponse(); $id_domanda = intval($_POST['id']); if ($id_domanda > 0) { $domanda = new Domanda($id_domanda); } if ($domanda->STATO == PREPARATA) { $filePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_PRESENTAZIONE); $filePath .= "/domanda_generata/" . $domanda->ALLEGATO_GENERATO; if (file_exists($filePath) && filesize($filePath) > 0) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($domanda->ALLEGATO_GENERATO)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($filePath)); ob_clean(); flush(); readfile($filePath); exit; } else { echo "Si prega di procedere alla generazione del file."; } } else { $response['erroreDescrizione'] = 'Operazione non consentita in questa fase.'; exit; } exit; } function downloadProtocollo() { global $LoggedAccount; $response = Utils::initDefaultResponse(); $id_domanda = intval($_POST['id']); if ($id_domanda > 0) { $domanda = new Domanda($id_domanda); } if ($domanda->STATO == PREPARATA) { $filePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_PRESENTAZIONE); $filePath .= "/domanda_protocollo/" . $domanda->FILEPATH_PROTOCOLLO; if (file_exists($filePath) && filesize($filePath) > 0) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($domanda->FILEPATH_PROTOCOLLO)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($filePath)); ob_clean(); flush(); readfile($filePath); exit; } else { echo "Si prega di procedere alla generazione del file."; } } else { $response['erroreDescrizione'] = 'Operazione non consentita in questa fase.'; exit; } exit; } function printAllegato($allegato, $domanda) { global $LoggedAccount; if (!empty($allegato) && !empty($domanda)) { if ($allegato->FILEPATH != "") { $file = $allegato->FILEPATH; if ($LoggedAccount->checkIstitutoFromLoggedAccount($domanda->CODICE_ISTITUTO)) { // controllo proprietario domanda switch ($allegato->TIPO_DOCUMENTO) { case TIPO_UPLOAD_OBBLIGATORIO: $basePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_PRESENTAZIONE); $basePath .= '/obbligatori/'; break; case TIPO_UPLOAD_OPZIONALE: $basePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_PRESENTAZIONE); $basePath .= '/opzionali/'; break; case TIPO_UPLOAD_ISTANZA: $basePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_PRESENTAZIONE); $basePath .= '/istanza/'; break; case TIPO_UPLOAD_CONTRIBUTO: $basePath = File::getFolderFromDomanda($domanda, ROOT_UPLOAD_EROGAZIONE); $basePath .= '/contributo/'; break; } $filePath = $basePath . $file; if (file_exists($filePath) && filesize($filePath) > 0) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($filePath)); ob_clean(); flush(); readfile($filePath); exit; } else { $msg = "Non è possibile visualizzare il file richiesto, contattare il supporto tecnico (1316)."; } } else { $msg = "Accesso non autorizzato"; } } else { $msg = "Non è possibile visualizzare il file richiesto, contattare il supporto tecnico (1321)."; } } else { $msg = "Non è possibile visualizzare il file richiesto, contattare il supporto tecnico (1325)."; } echo $msg; } function downloadEstrazioni() { global $TIPO_RICHIESTA; $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $rec = DomandaSconti::listLottoFromExport($lotto, $stato); $estrazione = new Esportazioni($lotto); $dataArray = array(); $row = 0; $intestazione = true; foreach ($rec as $key => $value) { if ($key == 0 && $intestazione) { foreach ($value as $k => $v) { $dataArray[$row][] = $k; } } $row++; $dataArray[$row] = $value; } //Utils::print_array($dataArray);exit(); $prefile = 'estrazione'; $basepath = ROOT_EROGAZIONE . "ESTRAZIONI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $file = $lotto . "_" . $stato . "_" . $prefile . "_" . $TIPO_RICHIESTA[$estrazione->TIPO] . "_" . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $report = $basepath . $file; $export->fromArray($dataArray)->saveAs($report); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadMandatiXls() { global $TIPO_RICHIESTA; $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $rec = DomandaSconti::listLottoFromMandatiXls($lotto, $stato); $estrazione = new Esportazioni($lotto); $dataArray = array(); $row = 0; $intestazione = true; foreach ($rec as $key => $value) { if ($key == 0 && $intestazione) { foreach ($value as $k => $v) { $dataArray[$row][] = $k; } } $row++; $dataArray[$row] = $value; } //Utils::print_array($dataArray);exit(); $prefile = 'mandato'; $basepath = ROOT_EROGAZIONE . "MANDATI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $file = $lotto . "_" . $stato . "_" . $prefile . "_" . $TIPO_RICHIESTA[$estrazione->TIPO] . "_" . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $report = $basepath . $file; $export->fromArray($dataArray)->saveAs($report); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadMandatiXml() { $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $basepath = ROOT_EROGAZIONE . "MANDATI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $nomeFile = time() . "_mandati.zip"; $destination = $basepath . $nomeFile; $zip = new ZipArchive(); $resZip = $zip->open($destination, ZIPARCHIVE::CREATE); //var_dump($resZip); if ($resZip !== TRUE) { $res['success'] = false; $res['descrizioneErrore'] = 'Errore: impossibile creare il file zip'; exit(json_encode($res)); } $record = DomandaSconti::listLottoFromMandatiXml($lotto, $stato); $blocchi = array_chunk($record, 100); $num = 0; foreach ($blocchi as $rec) { $xml_mandati = ""; $tot_Importo_Lordo = 0; foreach ($rec as $key => $value) { $xml_mandati .= ""; foreach ($value as $k => $v) { $xml_mandati .= "<" . $k . ">" . $v . ""; if ($k == 'Importo_Lordo') { $tot_Importo_Lordo += $v; } } $xml_mandati .= ""; } $tagXml_Id_mandato = TAGXML_ID_MANDATO; $tagXml_Capitolo = TAGXML_CAPITOLO; $tagXml_Anno_Provenienza = TAGXML_ANNO_PROVENIENZA; $tagXml_Impegno = TAGXML_IMPEGNO; $tagXml_Progressivo_DLQ = TAGXML_PROGRESSIVO_DLQ; $tagXml_Tipo_Mandato = TAGXML_TIPO_MANDATO; $tagXml_Collettivo = TAGXML_COLLETTIVO; $tagXml_Territorio = TAGXML_TERRITORIO; $tagXml_Importo_Lordo = number_format($tot_Importo_Lordo, 2, '.', ''); $tagXml_Importo_Netto = number_format($tot_Importo_Lordo, 2, '.', ''); $tagXml_Descrizione = TAGXML_DESCRIZIONE; $tagXml_Nr_Beneficiari = count($rec); $tagXml_Provincia = TAGXML_PROVINCIA; $tagXml_Comune = TAGXML_COMUNE; $tagXml_Modalita = TAGXML_MODALITA; $tagXml_Codice_SIOPE = TAGXML_CODICE_SIOPE; $tagXml_Impegno_Contestuale = TAGXML_IMPEGNO_CONTESTUALE; $tagXml_Data_Scadenza = TAGXML_DATA_SCADENZA; $string = "" . $tagXml_Id_mandato . "" . $tagXml_Capitolo . "" . $tagXml_Anno_Provenienza . "" . $tagXml_Impegno . "" . $tagXml_Progressivo_DLQ . "" . $tagXml_Tipo_Mandato . "" . $tagXml_Collettivo . "" . $tagXml_Territorio . "" . $tagXml_Importo_Lordo . "" . $tagXml_Importo_Netto . "" . $tagXml_Descrizione . "" . $tagXml_Nr_Beneficiari . "" . $tagXml_Provincia . "" . $tagXml_Comune . "" . $tagXml_Modalita . "" . $tagXml_Codice_SIOPE . "" . $tagXml_Impegno_Contestuale . "" . $tagXml_Data_Scadenza . "" . $xml_mandati . ""; $num++; $prefile = 'mandato-' . $num; $file = $lotto . "_" . $stato . "_" . $prefile . "_" . time() . ".xml"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $report = $basepath . $file; $xml = simplexml_load_string($string); $xml->asXML($report); $zip->addFile($basepath . $file, $file); } $zip->close(); $report = $destination; //Utils::print_array($dataArray);exit(); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($nomeFile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadListaMandatiXls() { $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $basepath = ROOT_EROGAZIONE . "MANDATI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $nomeFile = $lotto . "_" . $stato . "_mandati_" . time() . ".zip"; $destination = $basepath . $nomeFile; $zip = new ZipArchive(); $resZip = $zip->open($destination, ZIPARCHIVE::CREATE); //var_dump($resZip); if ($resZip !== TRUE) { $res['success'] = false; $res['descrizioneErrore'] = 'Errore: impossibile creare il file zip'; exit(json_encode($res)); } $record = DomandaSconti::listLottoFromPagamentiXls($lotto, $stato); $blocchi = array_chunk($record, 500); $num = 0; foreach ($blocchi as $rec) { $dataArray = array(); $row = 0; foreach ($rec as $key => $value) { if ($key == 0) { foreach ($value as $k => $v) { $dataArray[$row][] = $k; } } $row++; $dataArray[$row] = $value; } $num++; $prefile = 'mandato-' . $num; $file = $lotto . "_" . $stato . "_" . $prefile . "_" . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $reportXls = $basepath . $file; $export->fromArray($dataArray)->saveAs($reportXls); $zip->addFile($basepath . $file, $file); } $zip->close(); $report = $destination; //Utils::print_array($dataArray);exit(); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($nomeFile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadMandatoPdf() { $nomeFile = $_POST['nomeFile']; $basepath = ROOT_EROGAZIONE . "MANDATI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $report = $basepath . $nomeFile; ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($nomeFile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadEstrazioneVistaXls() { $success = true; $result = Utils::initDefaultResponse(); $rec = DomandaSconti::listEsportVista(); $dataArray = array(); $row = 0; $intestazione = true; foreach ($rec as $key => $value) { if ($key == 0 && $intestazione) { foreach ($value as $k => $v) { $dataArray[$row][] = $k; } $dataArray[$row][] = "STUDENTE"; $dataArray[$row][] = "DISABILE"; } $row++; foreach ($value as $k => $v) { if ($k == "FLAG") { $value['STUDENTE'] = Utils::isStudente($v) == 1 ? "SI" : "NO"; $value['DISABILE'] = Utils::isDisable($v) == 1 ? "SI" : "NO"; } } $dataArray[$row] = $value; } //Utils::print_array($dataArray);exit(); $prefile = 'estrazione'; $basepath = ROOT_EROGAZIONE . "ESTRAZIONI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $file = "VISTA_ALL_" . $prefile . "_" . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $report = $basepath . $file; $export->fromArray($dataArray)->saveAs($report); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function exportDecreti() { $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $omissis = intval($_POST['omissis']); $priorita = intval($_POST['priorita']); $intestazione = array("ID Richiesta", "COGNOME", "NOME", "CODICE FISCALE", "DATA DI NASCITA", "Località", "Provincia", "Importo sconto", "IBAN"); $dataArray = DomandaSconti::exportDecreti($lotto, $stato, $omissis); array_unshift($dataArray, $intestazione); $stringaPre = ""; if ($priorita == 0) { $stringaPre = "_Residenti"; } else { $stringaPre = "_Prioritari_"; } $stringaOm = ""; if ($omissis == 1) { $stringaOm = "_OMISSIS_"; } // Utils::print_array($dataArray);exit(); $prefile = 'Decreti'; $basepath = ROOT_EROGAZIONE . "ESTRAZIONI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $file = $prefile . $stringaPre . "_" . $lotto . "_" . $stringaOm . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $report = $basepath . $file; $export->fromArray($dataArray)->saveAs($report); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function exportAnagrafiche() { $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $priorita = intval($_POST['priorita']); $intestazione = array("COGNOME", "NOME", "CODICE FISCALE", "SESSO", "LUOGO DI NASCITA", "PROV", "DATA DI NASCITA", "INDIRIZZO", "CAP", "LOCALITA", "IBAN", "SCONTO_TOTALE"); $dataArray = DomandaSconti::exportAnagrafiche($lotto, $stato); $dataFormattata = array(); foreach ($dataArray as $row) { // Formatta la data nel formato corretto $row['DATA DI NASCITA'] = date('Y-m-d', strtotime($row['DATA DI NASCITA'])); $dataFormattata[] = $row; // Aggiungi la riga formattata a un nuovo array } array_unshift($dataFormattata, $intestazione); $stringaPre = ""; if ($priorita == 0) { $stringaPre = "_Residenti"; } else { $stringaPre = "_Prioritari_"; } // Utils::print_array($dataFormattata); // exit(); $prefile = 'Anagrafiche'; $basepath = ROOT_EROGAZIONE . "ESTRAZIONI/"; if (!is_dir($basepath)) @mkdir($basepath, 0777, true); $file = $prefile . $stringaPre . "_" . $lotto . "_" . time() . ".xlsx"; if (file_exists($basepath . $file)) @unlink($basepath . $file); $export = new SimpleXLSXGen(); $report = $basepath . $file; $export->fromArray($dataFormattata)->saveAs($report); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; } function downloadAnagraficheXls() { $success = true; $result = Utils::initDefaultResponse(); $lotto = intval($_POST['lotto']); $stato = intval($_POST['stato']); $basepath = ROOT_EROGAZIONE . "ANAGRAFICHE/"; if (!is_dir($basepath)) { @mkdir($basepath, 0777, true); } $nomeFile = $lotto . "_" . $stato . "_anagrafiche_" . time() . ".zip"; $destination = $basepath . $nomeFile; $zip = new ZipArchive(); $resZip = $zip->open($destination, ZIPARCHIVE::CREATE); if ($resZip !== true) { $res['success'] = false; $res['descrizioneErrore'] = 'Errore: impossibile creare il file zip'; exit(json_encode($res)); } // Recupero dati e formattazione $dataArray = DomandaSconti::exportAnagrafiche($lotto, $stato); $dataFormattata = array_map(function ($row) { $row['DATA DI NASCITA'] = date('Y-m-d', strtotime($row['DATA DI NASCITA'])); return array_slice($row, 0, -2); // Rimuove le ultime 2 colonne }, $dataArray); // Divisione in blocchi da 500 $blocchi = array_chunk($dataFormattata, 500); $start = 1; $cartelleCreate = []; foreach ($blocchi as $index => $rec) { $end = $start + count($rec) - 1; $folderName = "Anagrafiche_{$start}-{$end}"; $folderPath = $basepath . $folderName . "/"; if (!is_dir($folderPath)) { @mkdir($folderPath, 0777, true); $cartelleCreate[] = $folderPath; } // Creazione file Excel $fileName = "TemplateImportAnagrafica.xlsx"; $filePath = $folderPath . $fileName; $dataArray = []; $row = 0; foreach ($rec as $key => $value) { if ($key == 0) { $dataArray[$row] = array_keys($value); $row++; } $dataArray[$row] = array_values($value); $row++; } $export = new SimpleXLSXGen(); $export->addSheet($dataArray, 'template')->saveAs($filePath); // Aggiunta file allo ZIP $zip->addFile($filePath, "$folderName/$fileName"); $start = $end + 1; } $zip->close(); $report = $destination; foreach ($cartelleCreate as $folder) { deleteFolder($folder); } //Utils::print_array($dataArray);exit(); ob_clean(); if (file_exists($report)) { $url = $report; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . File::GetValidFilename($nomeFile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($url)); ob_clean(); flush(); readfile($url); exit; } else { echo "Il file non esiste!"; } exit; }