0
$url = $_GET['fileurl'];
$path_parts = pathinfo($url);

$ext = $path_parts['extension'];
$filename = $path_parts['filename'];

header("Content-type: video/$ext");
header("Content-Disposition: attachment; filename=$filename.mp4");

echo file_get_contents($url);

When the download starts, it does not show the user actual size of the file.. File Size shows only Unknown. So what should I do right now?

Philipp Sander
  • 10,139
  • 6
  • 45
  • 78
  • set the Content-Length header – Philipp Sander Jul 27 '17 at 09:37
  • Can you please explain it by coding? –  Jul 27 '17 at 09:47
  • 1
    no I won't. you can see it in th duplicate question I linked. – Philipp Sander Jul 27 '17 at 09:48
  • I have tried to understand a little bit. Now my code looks like this:- $url = $_GET['fileurl']; $path_parts = pathinfo($url); $ext = $path_parts['extension']; $filename = $path_parts['filename']; header("Content-type: video/$ext"); header("Content-Disposition: attachment; filename=$filename.mp4"); header("Content-Length: ".filesize($url)); echo file_get_contents($url); But it works the same as it was working previously! :( –  Jul 27 '17 at 10:01
  • What is the mistake in it? –  Jul 27 '17 at 10:02

0 Answers0