How can PHP be adapted to handle file downloads that are not in PDF format?

To handle file downloads that are not in PDF format in PHP, you can use the header() function to specify the content type of the file being downloaded. This will ensure that the browser knows how to handle the file being sent from the server.

<?php
$file = 'example.jpg';
header('Content-Type: image/jpeg');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
readfile($file);
exit;
?>