1

I get the attached error while creating a new folder under Storage Root. How can I fix this?? Is it not possible to create another folder under rootenter image description here

Edit There were folders under StorageRoot that disappeared after upgrade from Magento 2.4.4 to 2.4.5. The folders are visible in pub/media, but are not visible in admin panel media gallery.

1
  • No, you cannot create new folder under Storage Root. Its magento default feature. Dec 1, 2022 at 13:00

3 Answers 3

4

Since Magento 2.4.3-p1, for security purposes Magento only allows the media gallery access to the following two directories under /pub/media:

  • catalog/category
  • wysiwyg

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:

  1. Create a config.xml file.

If your module does not have one, create a config.xml file under the etc directory.

  1. 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/

3
  • Thanks for the answer. Whitelisted the folders this way and it worked. For those looking for answer, whitelisting folders will display if the folder already exists, creates a new one if it doesn't exist
    – Siri
    Dec 26, 2022 at 11:45
  • @Siri If my answer helps you resolve your issue or in case you already resolve your issue but no answer was given, you can see my answer is the only answer in this topic, if it is correct, please mark it as accepted. That will helps others with the same issue find out the verified answer easily.
    – Tu Van
    Dec 26, 2022 at 11:54
  • 1
    okay, though I had already fixed this, accepting the answer that might help others
    – Siri
    Dec 26, 2022 at 11:55
0

Do my way for declaring is correct . Please find the code below.

<system>
    <media_storage_configuration>
        <allowed_resources>
            <media_gallery_image_folders>
                <downloadable>downloadable</downloadable>
            </media_gallery_image_folders>
        </allowed_resources>
    </media_storage_configuration>
</system>

**

I am facing below error while running setup:upgrade or setup:di:compile

**" is invalid:
Element 'system': This element is not expected. Expected is one of ( default, stores, websites ).
Line: 3

Verify the XML and try again.****

Please let me know, If I did some mistake in this code.

1
  • This issue has been resolved. Need to add this code under the <default></default> handle. Then it will work.
    – Rahul
    Jan 12, 2023 at 12:44
0

I'm having issues when I try to add an image to a cms page. I'm just seeing the 'storage root' directory navigation with the 'loading' icon Image. Just hangs. This after upgrading to Magento 2.4.3-p3 Where does the config.xml go after adding the 'allowed_resources'? Before the upgrade I could see several folders within the wysiwyg folder. Help appreciated. Andy

4
  • you can add it in app/code/<yourvendor>/catalog/etc/config.xml
    – Siri
    Jan 25, 2023 at 20:06
  • What would the '<yourvendor>' be? Would it be module-cms as the vendor ?
    – AndyJH
    Jan 26, 2023 at 15:56
  • under app/code...you should have something which is your vendor...please read about creating your own module
    – Siri
    Jan 26, 2023 at 17:56
  • But I'm not even seeing the wysiwyg folder. The folder list doesn't load.
    – AndyJH
    Jan 30, 2023 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.