So I have this in my PHP script on my test site:
$file="clip.mp4";
$fake="clip_testing.mp4";
$fsize = filesize($file);
header("Content-Length: $fsize");
header("Content-Disposition: attachment; filename=$fake");
header("Content Type: application/download");
set_time_limit(0);
$fs = @fopen($file,"rb");
while(!feof($fs))
{
print(@fread($fs, 1024*8));
ob_flush();
flush();
}
When I use this to in a link and download the file, the first 7 bytes of my files are changed .. therefore I have to edit the program before I can use it. I have added a picture to make it more clear as to what I am talking about when I say the first 7 bytes have changed. Am I missing headers? Can anyone help me?
EDIT: If you guys are having a problem viewing the picture because of its size, look at the image in a new tab without the formatting so it will be its original size.
I think you have 4 empty lines before your <?php
tag.
That 8 Bytes are 4 times linebreaks \r\n
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With