Today I’m going to share a way to download files using htaccess. Last day I was implemented this code in my project. So, I thought to share my scripts with you. I hope that will help your in your project too. Lets get started –
Sometimes we need to force files for downloading. Most of the files like .zip, .rar show popup dialog to download if we add a direct download link with those files. But you can see that .mp3, .mp4, .mov file directly run in browsers though you add direct download link to them. If you want to force them to download and show popup dialog like other download then following htaccess code is perfect for you.
This htaccess code force browser to show popup download dialog box. Use this and have fun.
<Files *.xls>
ForceType application
/octet-stream
Header
set
Content-Disposition attachment
<
/Files
>
<Files *.eps>
ForceType application
/octet-stream
Header
set
Content-Disposition attachment
<
/Files
>
Enjoy!