skip to Main Content

I have not been able to upload images to my WordPress site using the media tool from the WordPress admin panel. I’m getting the following error.

“logo512x512.png” has failed to upload.
Unable to create directory wp-content/uploads/2020/01. Is its parent directory writable by the server?

I have gone through a ton of solutions to this problem but not one has worked for me. I am in the windows 2016 server machine. with a MySQL database. I do not have PhP admin not have a Cpanel.

My ftp is working. I am able to get themes and plugins without any problem. Any ideas?

3

Answers


  1. One possible issue is your chmod settings for folder wp-content. You may need to change chmod for the wp-content or it’s parent directory to allow the creation of any folder/file and child folder/file within that directory.

    Depending on which windows application you are using to set the chmod, would determine how this process is undertaken. I use FileZilla and you can simply –

    Right Click on wp-content, select File Attributes, and set Numeric value: 755.

    FileZilla set cdmod

    In addition, have you considered using a third-party webserver like XAMPP?

    Login or Signup to reply.
  2. I had a similar issue with a Google Cloud Engine Instance, with no cPanel, no phpMyAdmin and FTP, on Ubuntu and Apache. And I solved this way:

    1. Define upload folders on wp-config.php

    Open wp-config.php with nano or vim and add the following code

    define( 'UPLOADS', 'wp-content/uploads' );
    

    before this line:

    require_once(ABSPATH . 'wp-settings.php');
    

    and save it.

    2. Change owner

    Change to wp-content directory. In my case (use your own path):

    cd /var/www/html/wp-content
    

    Next, change the owner to www-data

    chown -R www-data:www-data plugins
    

    Why www-data? In my case, is the name of the apache service account running on my server. You can check the name with:

    ps aux | egrep '(apache|httpd)'
    

    that comand returns some like this:

    www-data  5441  0.0  5.8 566184 34896 ?        S    06:34   0:00 /usr/sbin/apache2 -k start
    www-data  7753  0.0  5.9 566248 35512 ?        S    09:00   0:00 /usr/sbin/apache2 -k start
    www-data  9840  0.0  5.7 566160 34320 ?        S    11:21   0:00 /usr/sbin/apache2 -k start
    www-data 21068  0.0  6.2 564032 37192 ?        S    18:22   0:00 /usr/sbin/apache2 -k start
    www-data 21069  0.0  6.0 563692 35636 ?        S    18:22   0:00 /usr/sbin/apache2 -k start
    root     21455  0.0  0.1  13208  1036 pts/1    S+   18:44   0:00 grep -E --color=auto (apache|httpd)
    root     31982  0.0  1.1 485904  6872 ?        Ss   Jan03   0:18 /usr/sbin/apache2 -k start
    

    as you see, root and www-data. Maybe with windows server the account will be different (tasklist? pslist?), i don’t know how to get it (I never used windows server, sorry). I Hope www-data works for you.

    Finally, make sure uploads folder had the right permissions

    chmod 755 -R uploads
    

    3. Grant to that user rights to use WordPress

    To html or public_html folder (in my case /var/www/html, change it for your own path)

    chown -R www-data /var/www/html
    

    And voilà. I hope this little guide was useful, or at least, give you ideas to solve it!

    Login or Signup to reply.
  3. Well friends said about putting permissions on directories …
    But on Windows there is a difference between Linux, what I recommend is to put WP-content (just this folder) as chmod 0777 and so in the current upload folder (2020) as chmod 0777.
    That should do it. And even if you see that there is advice to always put 0755 I advise you to leave it specifically in these folders.

    Make a backup before any changes and I believe it will help you are managing to upload

    a good alternative is every month that WordPress creates a new folder for that month then you change the folder permission to 0755 according to the month ended so it helps Ah you have more confidence in the security issue

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search