简体   繁体   中英

mp4 file format changed to exe runs in browser

Hi i have stumbled up on something really weird I was just testing a download button because I cannot download an mp4 file format on a local server I just changed an mp4 files extension to .exe and when i tried to download the .exe it plays within the browser. whats happening is this streaming the video or is this something random that I have found that should not be done on a website?

If you want the file to be downloaded you should add the extensions to the .htaccess for example:

AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf

Credits to CSS Tricks - Force Files to Download .

Update

If your server is using IIS you should add them as described in this article Add a MIME Type (IIS7) . For older versions of IIS please see this article.

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