This is one of those problems that I am now sure I have been doing all wrong.
I have a folder that stores various media (large files, video, jpegs etc).
Already, I have a script to generate a menu from the file names of everything in the folder.
I want to click the file name and display the media, (whatever it is). I can get it to display the media without anything else on the page. If I include antyhing else it opens the binary file as text.
I presume I am missing something here... I am just sick of looking at this code.
I have a simple example of what I am doing here:
<?php
$path = "/path/to/the/directory"
$file = "named.mov" # generated dynamically by user input
include("somethingElse.php");
include("$path/$file");
?>
as well as
<?php
echo "show something else here";
if ($file = fopen($path, 'rb')) {
stream_set_timeout($file, 2);
while(!feof($file) and (connection_status()==0)) {
$stream = fread($file, 1024*8);
echo ($stream);
}
$status = (connection_status()==0);
fclose($file);
}
?>
and other variations using fopen and fread etc. Everything works as long as I want nothing else displayed on the page.