In memory file handling to get mime type

$fh = fopen('php://memory', 'w+b');
fwrite($fh, $imageData);
$contentType = mime_content_type($fh);
fclose($fh);
Edit this page