I need to know what may be causing the issue (wysiwyg is not under storage root path) of not being able to upload image. Any idea would help a lot.

Here is a screenshot of the error message with red highlight

Directory C:/xampp/htdocs/rohivic/pub/media/wysiwyg is not under storage root path.

  • try to upload image in other browser
    – inrsaurabh
    Apr 2, 2018 at 3:44

5 Answers 5


As of 2.2.3, it's not possible to upload images via the WYSIWYG if the media directory is a symlink. This is due to this new file. UPDATE: This issue has been fixed in Magento 2.2.5 and 2.3.0. See this Github issue and the fix.


We've temporarily fixed this by changing this line from this:

$realPath = realpath($path);
$root = $this->directoryList->getPath($directoryConfig);

to this (note the addition of the realpath function call):

$realPath = realpath($path);
 * Since media directory is a symlink, need to run both paths through realpath in order for the comparison to
 * work.
 * The proper fix for this should involve a STORE > Configuration setting where an admin can choose whether to
 * allow symlinked directories.
$root = realpath($this->directoryList->getPath($directoryConfig));

All information taken from this ticket as pointiA mentioned.


Run the below command and check it:

php bin/magento config:set system/security/max_session_size_admin 0

php bin/magento c:f

If your folder is not showing then create the below code.

For security purposes, Magento provides Media Gallery access to contents in specific folders. The configuration path system/media_storage_configuration/media_storage/allowed_resource/media_gallery_image_folders in config.xml is used to define “Media Gallery Allowed” folders

By default, Magento allows Media Gallery access to the following two directories under /pub/media:

  • catalog/category

  • wysiwyg


<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
                    <catalog_images_folder>catalog</catalog_images_folder> <!-- Show Catalog Folder -->
                        <category_image_folder>catalog/category</category_image_folder> <!--  Show Sub Catalog Folder -->

looks like you are using the latest Magento 2.2.3. They did some security improvements that prevent using symlinks and so.

Maybe this issue will help you: https://github.com/magento/magento2/issues/13929


You have a problem with permissions.

For Linux - You must run this commands:

find ./pub/media -type d -exec chmod 777 {};

For Window - You must create a folder wysiwyg in this path C:/xamp/htdocs/rohivic/pub/media/ and you click right on project folder to Properties and you must be unchecked the Read Only.

  • I am on local host using xampp. Not a live server. How do i go about that?
    – Daniel
    Apr 1, 2018 at 21:22
  • I updated my answer.
    – St3phan
    Apr 1, 2018 at 21:27
  • Thank you St3phan for your effort. But somehow the problem seem persistent. Any more suggestions?
    – Daniel
    Apr 1, 2018 at 21:47
  • I updated again my answer. I added to create the folder wysiwyg
    – St3phan
    Apr 2, 2018 at 8:06

Daniel First, you can open a terminal then you can go in your Magento files then you can give permission Pub folder.

chmod -R 777 pub/

if can't working this commnad you can try to sudo chmod -R 777 pub/

  • 1
    This is bad advice. Giving all directories under pub 777 permissions is dangerous for more reasons that can be covered in a Stack comment.
    – John Hall
    Nov 10, 2020 at 20:51
  • @JohnHall Hope you are well, It's not bad if the folder wants permission that time we used chmod -R 700 or any other.
    – Tushar
    Nov 12, 2020 at 11:19
  • And Thank you give your suggestion, If the Magento instance have a permission issue in this case First he wants to check the permission of var, generated, pub/static pub/etc. After as needed give permission.
    – Tushar
    Nov 12, 2020 at 11:22

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.