What function/method should I use for file_directory_path()? In Drupal 6, I am using the following code.

$id = fileowner(file_directory_path());


What is the Drupal 8 equivalent of that code?
You can use the following code.

$real_path = \Drupal::service('file_system')-&gt;realpath(file_build_uri(''));


On my test site, it returns '/Library/Server/Web/Data/Sites/avpnet/sites/default/files'.

You can also pass a filename to file_build_uri().

$real_path = \Drupal::service('file_system')-&gt;realpath(file_build_uri('file.jpeg'));


With this code, I get '/Library/Server/Web/Data/Sites/avpnet/sites/default/files/file.jpeg'.