PHP - The archive is either in unknown format

0

I've created a script that downloads the paths shown in the MYSQLI column Whenever I create a new record with the path and send the file to the specific folder, that's fine.

When I will dowload using:

function download($file_name, $file_path) {

        header('Pragma: public'); 
        header('Content-Description: File Transfer');
        header('Cache-Control: public'); 
        //header('Content-Type: application/zip');
        //header('Content-Type: application/x-zip-compressed');
        //header('Content-Type: multipart/x-zip');

        header('Content-Type: application/x-rar');    
        header('Content-Type: application/x-rar-compressed');
        header('Content-Type: application/octet-stream');

        header('Content-Transfer-Encoding: binary');
        header('Content-Disposition: attachment; filename="' . basename($file_name) . '"');
        header('Content-Length: '. filesize($file_path));
        header('Expires: 0');            

        readfile($file_path);
        exit;    

}

The browser simply warns that "The archive is either in unknown format or damaged".

And also subscribe to it from VIRUS.

I do not understand what to do ... I need a little push ...

    
asked by anonymous 01.02.2018 / 01:48

0 answers