Force download with Header does not work in PHP [closed]

1

I use this code to force download, it works fine when I squeeze it in XAMPP, but it returns corrupted file when I run on the ubunto, what can I do to fix it?

        header('Content-Length: ' . filesizecurl($file_path));
        header('Content-Type: "application/zip"');
        header('Content-Disposition: attachment; filename="'.basename($new_name).'"');
        header("Content-Transfer-Encoding: binary");
        header('Expires: 0');
        header('Pragma: no-cache');
        // Envia o arquivo para o cliente
        readfile($file_path);
    
asked by anonymous 02.04.2017 / 04:02

0 answers