drupal 7 get field file url code example
Example: drupal 8 get file url from target id
use Drupal\media\Entity\Media;
use Drupal\file\Entity\File;
$media = Media::load($mid);
$fid = $media->field_media_image->target_id;
$file = File::load($fid);
$url = $file->url();