I seem to have a problem in my PHP code, whenever I access the file in my browser, it automatically downloads the file, when it should instead display the file. Here's my code:
$fileID = $_GET['f'];
$con = mysql_connect("localhost","root","password");
die("Coulnd't connect to serer: ". mysql_error());
$FileID = mysql_query("SELECT FileSRC FROM FileCenter WHERE FileKEY = '$fileID'");
$result = mysql_fetch_array($FileID);
$FMime = checkMime($result['FileSRC']);
$contents = file_get_contents($result['FileSRC']);
header('Content-type: '. $FMime);
Like you discovered the headers aren't being set because output had already started earlier in the php file.
On the third line you have
The checkMime function in GetMime.php has
echo finfo_file($finfo, $fileDES);
checkMime before you set the header. You can't echo anything out before setting the headers.