<?php

$file = '/home/fuiedu5/conferenceUploads/reg/' . basename($_GET['file']);

if (!file_exists($file)) {
    die("File not found");
}

$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));

switch ($extension) {
    case 'pdf':
        header('Content-Type: application/pdf');
        break;

    case 'jpg':
    case 'jpeg':
        header('Content-Type: image/jpeg');
        break;

    case 'png':
        header('Content-Type: image/png');
        break;

    case 'gif':
        header('Content-Type: image/gif');
        break;

    default:
        header('Content-Type: application/octet-stream');
}

header('Content-Disposition: inline; filename="' . basename($file) . '"');

readfile($file);
exit;