Forums

[resolved] WordPress Network Install - unable to upload files (17 posts)

  1. mobcdi
    Member
    Posted 5 months ago #

    I know this is probably a very basic error I am making but please bear with me.
    I downloaded and installed wordpress 3.2.1 During the installation the installer wasn't able to create the files/folders itself so I modified the wp-config file using cPanel web interface.
    I also enabled and configured networking and created the blogs.dir folder in wp-content and edited .htaccess file with the values the network install provided. I am using sub-directories

    The problem is when I try upload either using the media library or even adding images to 2011 theme i get "unable to create directory"

    I checked the permissions for wp-content (755) and blogs.dir (755) but also tried setting to 775 for both but that didn't resolve it either.

    The owner of wp-content and blogs.dir is the cPanel account I used.

    Is there something I am missing?

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 5 months ago #

    Which blog is having trouble uploading images? All of them?

  3. mobcdi
    Member
    Posted 5 months ago #

    Yes its all sites in the network. There is a .htaccess file in the webroot but none in wp-config or its subfolders blog.dir Could that be the cause of the issue?

    This is the part of that htaccess file that mentions files, I also have url rewriter for permalink customisation if that makes a difference.

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    Is there a plugin that might help diagnose the cause by any chance?

  4. hiteshanjara
    Member
    Posted 5 months ago #

    Hey modcdi,

    First, You need to change the upload path of subdomain by defining it in wp-config.php file define('UPLOADS', 'wp-content/uploads'); So that all uploaded files will be store in 'uploads' folder.

    And then you need to change the upload directory path(baseurl)

    I think current baseurl is "http://subdomain.domain.net/files" so you need to change it by adding below code in subdomain function.php file.

    /* Change the upload baseurl */
    function change_upload_path( $pathdata ) {
         // change path here
         $pathdata["baseurl"] = "http://subdomain.domain.net/wp-content/uploads";
         return $pathdata;
    }
    add_filter('upload_dir', 'change_upload_path');

    I hope this will help you.

    Thanks & Regards,
    Hitesh Anjara

  5. mobcdi
    Member
    Posted 5 months ago #

    Hi Hitesh,
    Is there a reason why wordpress didn't include that setting when I installed network or why its not mentioned on http://codex.wordpress.org/Create_A_Network

  6. hiteshanjara
    Member
    Posted 5 months ago #

    Hello mobcdi,

    I am not sure about default network setting. I just have faced same problem while uploading images in subdomain site.

    I did some google search but not working for me, so I have to add filter to change the upload directory path in which I faced a problem.

    Sorry for less information.

    Thanks,
    Hitesh Anjara

  7. mobcdi
    Member
    Posted 5 months ago #

    Its been a while since I used wordpress, there used to be a setting where you could set where uploaded files were to be saved but I can't find that anymore. Has it been moved to the wp-config as a setting that should only be modified if you are not doing a vanilla install?

  8. hiteshanjara
    Member
    Posted 5 months ago #

    You can find the list of sites by using this url - http://domain.net/wp-admin/network/sites.php

    When you click Edit link it will display the site information. On this page, you can see currently uploaded files were to be saved.

    I think you can change that upload file path there.

  9. mobcdi
    Member
    Posted 5 months ago #

    Thanks, Found it under the settings tab on that edit page.

    Does it matter that the root site has a upload path of wp-content/uploads but I don't have that folder created?

    The other sites have an upload path of wp-content/blogs.dir/2/files so I think wordpress is actually trying to use the correct location its just not able to create folders or save files

  10. hiteshanjara
    Member
    Posted 5 months ago #

    If you don't want to create any folder then I think you just need to put following code in your sub domain function.php file

    /* Change the upload baseurl */
    function change_upload_path( $pathdata ) {
         // change path here
         $pathdata["baseurl"] = "http://subdomain.domain.net/wp-content/blogs.dir/2/files";
         return $pathdata;
    }
    add_filter('upload_dir', 'change_upload_path');

    I hope this will work from your end. Let me know if you face any problem on the same.

  11. mobcdi
    Member
    Posted 5 months ago #

    I would prefer to avoid modifying core especially since the number of sites will increase once I solve the problem. I think its probably a permissions issue

  12. hiteshanjara
    Member
    Posted 5 months ago #

    It is not core file, I am talking about theme function.php file.

    You can find it in your theme foder "subdomain-folder/wp-content/themes/current_theme_folder/function.php"

    But you can try it in different way as per your requirements and let me know when you get a solution of it without editing any file.

    Thanks,
    Hitesh Anjara

  13. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 5 months ago #

    What the...

    First, You need to change the upload path of subdomain by defining it in wp-config.php file define('UPLOADS', 'wp-content/uploads'); So that all uploaded files will be store in 'uploads' folder.

    WOAH WOAH WOAH.

    You do not ever, never ever ever, need to 'change' the upload path of the subdomains!!

    Hitesh I have no idea where you got THAT idea from.

    mobcdi

    Ignore everything he told you. You DO NOT need to change your functions file (which is a theme file). Me, and everyone else who uses WP, can use the blogs.dir setup. It works just fine.

    I also have url rewriter for permalink customisation if that makes a difference.

    That. Yes, turn that off :)

  14. Andrea_r
    team pirate
    Posted 5 months ago #

    Hitesh - he is not using a separate subdomain install. He's using multisite. Your advice does not apply and is a total red herring.

  15. hiteshanjara
    Member
    Posted 5 months ago #

    I'm really very very sorry to all.

    I have faced same problem, and my friend suggested me to put patch because we have not enough time to finish our work.

    Sorry mobcdi, Please let me know if you have any better solution of it without editing any files.

    I hope you can understand.

  16. mobcdi
    Member
    Posted 5 months ago #

    I didn't actually make the changes outlined. I did switch to a host using suPHP instead of dso for php processing and also had the hosting account used for this install of wordpress re-created from scratch so all files, folders ownership and permissions were as new.

    I uploaded wordpress setup and finished off the install which went smoother because of the change

    The switch of host solved the problem I was having for the main site and sub-sites.

  17. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 5 months ago #

    I did switch to a host using suPHP instead of dso for php processing

    AHA!

    Okay, now I know what happened, and I know how to fix DSO (having been there myself). Basically there are some extra settings you want to toss in your wp-config.php (see http://tech.ipstenu.org/2011/wordpress-dso-and-permissions/ for details).

    But yay for working!

Reply

You must log in to post.

About this Topic