ZipArchive not opening file - Error Code: 19

荒凉一梦 提交于 2019-11-29 07:09:24

Open the archive with a text or hex editor and make sure you have the 'PK' signature at the start of the file. If you have any HTML before that signature, it would suggest that your buffers are not being cleaned or are being flushed when they should not be, meaning that PHP ZipArchive will assume an invalid archive.

It was the download.php file that was causing the issue, here is the solution. which was to do a OB CLEAN rather than a Flush

    ///echo "<div style='padding: 50px;'>Please Wait .....</div>";
    $fileID = $_GET['id'];
    $backupLoc = "backups/";
    $sql = "SELECT * FROM backups WHERE id = '" . addslashes($fileID) .  "' LIMIT 1";
    $res = mysql_query($sql);
    $row = mysql_fetch_array($res); 
    $backupFile = $row['backupFile'];
    $zipFile = $backupLoc . "/" . $backupFile . ".zip";
    $zipSize = filesize($zipFile);

    header('Content-type: application/zip');
    header('Content-Disposition: attachment; filename="' . basename($zipFile). '"'); 
    //ob_end_flush();
    ob_end_clean(); 
    readfile($zipFile);
    exit;
    die();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!