<?php $finfo = new finfo(FILEINFO_MIME); echo $finfo->buffer($_POST["script"]) . "\n";?>
The above example will output something similar to:
application/x-sh