mercredi 15 février 2017

PHP show image and video

<?php
$file = $_GET['path'];
$finfo = finfo_open(FILEINFO_MIME_TYPE);

header('Content-type: '.finfo_file($finfo, $file));
if(substr(finfo_file($finfo, $file), 0, 4) == "text")
    header('Content-Transfer-Encoding: text');
else
    header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');

@readfile($file);
?>

With this source code I can see image in my MBP but can't see image in my window desktop.
Instead of image it shows http://ift.tt/2lJOL1X to me. I use window 10, php7 and Apache 2.4 for my desktop. I found I have to include some modules to use finfo_open so I included it. However I can't understand why I can't get correct image

Also I want to play video with that code. However video doesn't played in both MBP and desktop. I can't find the reason can anyone help me plz?

Aucun commentaire:

Enregistrer un commentaire