D8 - Get Public and private file path in custom module/code


1) To get the Public directory path in custom module/code

$Public_base_path = \Drupal\Core\StreamWrapper\PublicStream::basePath();

2) To get the Private directory path in custom module/code

$Private_base_path = \Drupal\Core\StreamWrapper\PrivateStream::basePath();

Comments

Popular posts from this blog

PHP - How to increase size of POST value in php

D8 KernelEvents constants

D8 - Attach file programmatically to a node