I have a .mp4 video in my /videos folder.
I want the user to click a link and then for the video to download to their computer or samsung galaxy.
When I click on my link it downloads the video. However, it's corrupt. It literally has a file size of 0kb.
This is the link www.example.com/download.php
On this page has the following code
<?php
$download = "http://www.example.com/videos/video.mp4";
header("Content-type: video/mp4");
header("Content-Disposition:attachment;filename=\"$download\"");
//allways a good idea to let the browser know how much data to expect
header("Content-length: " . filesize($download) . "\n\n");
echo file_get_contents($psp); //$download should contain the full path to the video
Does anyone know why this isn't working?