Internet Explorer Content-DIsposition File Id Not Working

right now im sends php (later replaced by nodejs) headers for downloading the file as follows:

    <?php
    // example array for .exe (for IE, doesnt work)
    // i also tried x-msdownload
    $file = array( 'octet-stream', 'download.exe' );
    header( 'HTTP/1.0 200 OK' );
    header( 'Content-Type: application/'.$file[0] );
    // thats the part that doesnt work - i tried inline; attachment; with quotes, without quotes, single quotes, ending ; no ending ;...
    header( 'Content-Disposition: filename="'.$file[1].'";' );
    header( 'Content-Length: '.filesize( $file[1] ) );
    readfile( $file[1] );
    exit;
    ?>

the result is always the same - I rewrite the downloads to the following folder: / download / 123 / - the content header should correspond to the correct file name, but IE shows both the file name “123” and “Unknown file type” ... now, even if I rewrote everything after the ID in the index.php and request folders for example: /download/123/something.exe, it will still display as "something" and "Unknown file type". no matter what I set as a content type, or how I order content values.

IE, - - , ?

!

EDIT: , , , : IE .EXE " - - " " " " - - ". . , microsoft, , x-msdownload ( )...

+3
1

Content-Disposition , :

 header("Content-Disposition: inline; filename=xyz.exe");

- . attachment, .

MIME application/octet-stream. IIRC application/x-msdos-program.

+2

Source: https://habr.com/ru/post/1776348/


All Articles