I've uploaded a file in a custom form and I can retrieve the file instance like this:
$fid = $form_state->getValue('file')[0];
$file = File::load($fid);
How can I get the contents of the file?
kint(file_get_contents($file->url()));
Returns false. If I visit the link manually, it gets downloaded.