Since Magento 2.4.3-p1, for security purposes Magento only allows the media gallery access to the following two directories under /pub/media:
In versions 2.4.3-p1 and higher, you must modify media library folder permissions in a 'config.xml' file.
The configuration path system/media_storage_configuration/allowed_resources/media_gallery_image_folders in config.xml defines the "Media Gallery Allowed" folders.
To extend "Media Gallery Allowed" folders using the config.xml file, follow the following steps:
- Create a
config.xml file.
If your module does not have one, create a config.xml file under the etc directory.
- Add a new "Media Gallery Allowed" folder:
<system> <media_storage_configuration> <allowed_resources> <media_gallery_image_folders> <!-- new "Media Gallery Allowed" folders --> <my_image_folder>custom_folder_name</my_image_folder> <my_catalog_image_folder>catalog/custom_folder_name</my_catalog_image_folder> </media_gallery_image_folders> </allowed_resources> </media_storage_configuration> </system>
where custom_folder_name and catalog/custom_folder_name are folder paths under /pub/media.
Source: https://developer.adobe.com/commerce/php/tutorials/backend/modify-image-library-permissions/