简体   繁体   中英

Add additional MIME types using .hataccess & PHP

When i am download a file from my webserver php fetch the MIME types so the browser knows what to open the file with. On my website a have a mixture of file types.

I would like to add a MIME type to the list PHP recognise:

This is how my server download a file using PHP to a computer:

if (file_exists($file)) {
header( 'Cache-Control: public' );
      header( 'Content-Description: File Transfer' );
      header( "Content-Disposition: attachment; filename={$file}" );
      header( 'Content-Type: ' . mime_content_type($file) );
      header( 'Content-Transfer-Encoding: binary' );
      readfile( $file );
      exit;
}

Now some website sugestion you can add MIME types using .hatacces files http://www.htaccess-guide.com/adding-mime-types/

So this is what i put in my htacces folder so that it recognise viso file formats:

AddType application/x-viso .vsdx

When i download a viso file from the server it doesn't recognise it a viso file using Firefox. I do have viso install. Can anyone help?

尝试使用AddType text/x-visio .vsdx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM