How do I check the content type of a file using hook_file_presave
The file itself has no reference to the parent node (it can be referenced by multiple entities). But you can get the node type you are adding or the node you are editing when you upload the file from the route:

function modulename_file_presave(\Drupal\file\FileInterface $file) {
  if ($file-&gt;getMimeType() == 'image/jpeg') {
    switch (\Drupal::routeMatch()-&gt;getRouteName()) {
      case 'node.add':
        $content_type = \Drupal::routeMatch()-&gt;getRawParameter('node_type');
        break;

      case 'entity.node.edit_form':
        $node = \Drupal::routeMatch()-&gt;getParameter('node');
        $content_type = $node-&gt;getType();
        break;

      default:
        $content_type = NULL;
    }
  }
}