How can you check the file type of an uploaded file in PHP to ensure it is a jpg file?
To check the file type of an uploaded file in PHP to ensure it is a jpg file, you can use the `$_FILES` superglobal to access the file information, specifically the `type` property which contains the MIME type of the file. You can then compare this MIME type to the expected MIME type for a jpg file, which is `image/jpeg`.
if ($_FILES['file']['type'] == 'image/jpeg') {
// File is a jpg file
echo 'File is a jpg file';
} else {
// File is not a jpg file
echo 'File is not a jpg file';
}