0

I need to set two file_public_base_urls and two file_public_paths in settings.php in Drupal 8.7. and have them associated with each other. For example:

$settings['file_public_base_url1'] = 'http://downloads.example.com/files/media1';

is associate with

$settings['file_public_path'] = 'sites/default/files/media1';

and

$settings['file_public_base_url2'] = 'http://downloads.example.com/files/media2';

is associate with

$settings['file_public_path'] = 'sites/default/files/media2';

Does Drupal core support this, or it can only be achieved programmatically? Any ideas or suggestions?

Basically, I need to separate the uploaded files between audio files and other files, such as image files. For example, when an editor uploaded an audio file, it would be saved in sites/defaults/files/audio directory. When an image file is uploaded, it would be saved in sites/defaults/files/image directory.

I have been looking at basePath function in PublicStream.php in Drupal core tried to find a way to determine if an uploaded file is mp3, so I can save it to sites/defaults/files/audio directory, but with no luck.

  • You mean to declare your own variable in settings.php and request them via Settings::get('my_variable', 'foobar');? – leymannx Aug 25 at 0:09
  • Basically, I need to separate the uploaded files between audio files and other files, such as image files. For example, when an editor uploaded an audio file, it would be saved in sites/defaults/files/audio directory. When an image file is uploaded, it would be saved in sites/defaults/files/image directory. – newdrupaluser Sep 8 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.