![Google chrome browser download videos](https://kumkoniak.com/76.jpg)
![google chrome browser download videos google chrome browser download videos](https://cococut.net/img/tutorial/en/1.png)
You can put the code above in a file: download.jsp I am working on jsp technology, if you can use jsp in your website you can try the following code in the file download.jsp: You need a server-side code to download the file 'Content-Disposition: attachment filename="myfile.mp4" 'Content-Type: application/force-download'
![google chrome browser download videos google chrome browser download videos](https://tipsmake.com/data/images/top-10-chrome-extension-helps-manage-and-speed-up-downloads-picture-1-3bPnAlPVc.jpg)
No matter what your server side technology is, the headers to look out for are: 'Content-Description: File Transfer' Here 'Content-Type: application/force-download' will force the browser to show the download option no matter what's the default setting is for a mime-type. Header('Content-Type: application/force-download') Header('Content-Disposition: attachment filename="'.$filename.'"') Header('Content-Description: File Transfer')
![google chrome browser download videos google chrome browser download videos](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Google_Chrome_icon_(February_2022).svg/640px-Google_Chrome_icon_(February_2022).svg.png)
Assume that $filename and $filePath are correclty set. $fileName = $fileId."mp4" //or a name from database like getFilenameForID($id) $filePath = "/pathToVideoFolder/".$fileId."mp4" The link you can show in the html will be like: Click here to Download Hello.mp4Īnd in the server side, you need a script which is being called on /downloadFile (depending on your routing), get the file by id and send it to user as an attachment. Ofcourse to simplify and generalize this for all your files, you may need to write a method which will route a link to downloadable content. PHP: header('Content-Disposition: attachment filename="'.$nameOfFile.'"') You have to use the HTTP header " Content-Disposition" and ' Content-Type: application/force-download' which will force browser to download the content instead of displaying it there.ĭepending upon the server side language you are having the implementation differs.
![Google chrome browser download videos](https://kumkoniak.com/76.jpg)