3

In Craft 3.2.10, I'm getting this error message when I try to upload an image asset:

Upload failed. The error message was: “Impossible to create the root directory "/Users/me/Work/Client/repo/web/craftcms-assets/project-slide-photos". mkdir(): Permission denied”

I've made the permissions for project-slide-photos to 777 and 774, and likewise tried both for the parent directory. Is it trying to create a directory that's already there? I tried removing project-slide-photos also, and it still doesn't work.

What do I need to do to make my assets upload into this directory?

Edit: Wondering if using Docker Compose could have something to do with this:

docker-compose.yml:

version: '3'
services:
    web:
        image: 'flipbox/php:72-apache'
        ports:
            - '80:80'
            - '443:443'

        volumes:
            - '.:/var/www/html/'
        environment:
            ENVIRONMENT: dev
            DB_SERVER: db
            DB_USER: craft
            DB_PASSWORD: craft
            DB_DATABASE: craft
            XDEBUG_ON: "yes"
            XDEBUG_HOST: "host.docker.internal"
            XDEBUG_IDEKEY: "PHPSTORM"
            APACHE_DOCUMENT_ROOT: "/var/www/html/web"
    db:
        image: 'mysql:5.7'
        restart: always
        ports:
            - '3306:3306'

        volumes:
            # Location to import a database dump. 
            - ./src:/docker-entrypoint-initdb.d
            # Location of the generated mysql files.
            - ./mysql:/var/lib/mysql

        environment:
            MYSQL_ROOT_PASSWORD: password
            MYSQL_DATABASE: craft
            MYSQL_USER: craft
            MYSQL_PASSWORD: craft

2 Answers 2

4

I understand now within the context of you are using docker. Since docker creates a new file system separate from your computer's file system, you will want to run these commands on the docker instance.

I do not use docker regularly, but I believe you can use docker attach while the droplet is running to access the droplet's file system.

You will want to set the parent folder to have higher privileges. Try this command:

chmod 774 craftcms-assets

Privileges are composed of three numbers: self, group, and world. There are also three access levels: read, write, and execute. 7 will give access to read, write, and execute. You will want to use 7 for your own commands (self) and for craft's commands (group), but not for the general public (world).

Hope this helps!

5
  • Ok I tried that, and I'm still getting the error.
    – BBaysinger
    Commented Aug 27, 2019 at 21:48
  • it's the same error? can you make sure that the web and repo folders have 774 also Commented Aug 27, 2019 at 22:02
  • Hm. Yup, same error. Changed both of those, and it's still not working.
    – BBaysinger
    Commented Aug 27, 2019 at 22:04
  • Realized Docker Compose could have something to do with it. Updated my question.
    – BBaysinger
    Commented Aug 27, 2019 at 22:07
  • @BBaysinger I've updated my answer with docker information! Commented Aug 28, 2019 at 14:05
2

Since this is the top result on Google for this error, I wanted to add that what fixed it for me (a non-docker user) was setting the permissions for the "/assets/images" directory to 775.

Craft's documentation says to set certain folders to 774, but evidently it needs that Public Execution permission for the system to recognize it.

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.