WordPress.org

Ready to get started?Download WordPress

Forums

Image upload issue (51 posts)

  1. ChrisTorp
    Member
    Posted 4 years ago #

    I have recently installed WordPress MU and it seems to work perfectly except for one issue. Whenever I try to upload a picture (might also be a problem for other types of uploads, but I've only tried pictures) it seems to upload normally and it even gets the size of the image, but the image itself won't show and when I try opening the image in a new tab I only get an error page as if nothing is there.

    This problem is not only for posts, but also for the custom header and avatar for the buddypress plug-in.

    I have tried re-installing with no luck. However the normal version of wordpress works just fine.

    Any solutions?

  2. Michael Bishop

    Posted 4 years ago #

    did you create a blogs.dir in wp-content?

  3. ChrisTorp
    Member
    Posted 4 years ago #

    The installation did that on it's own, so it's there yes.
    All the files I've uploaded are even there, but I can't see any of them on the actual sites.

  4. You should upgrade to 3.0 to start. ;)

    A link to your site will be really handy.

  5. ChrisTorp
    Member
    Posted 4 years ago #

    I do have 3.0.

    Nothing on the site will really help unless you're a member and trying to upload a picture as avatar or if you're able to post something. Maybe making a test blog there just to try it out. If you wanna try that.

    http://www.deephopes.com

  6. Did you create the blogs.dir folder under /wp-content/ ?

  7. enjaytee
    Member
    Posted 4 years ago #

    Are you running IIS7? I have struggled with this but just solved it with a rewrite rule in the web.config. I'll paste the whole lot it as there is a rule to help with pretty permalinks aswell:

    <rule name="Uploaded Files" stopProcessing="true">
                        <match url="^files/(.+)" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" />
                    </rule>

    This is my first post so if the code looks awfull sorry.

  8. enjaytee
    Member
    Posted 4 years ago #

    Oh I didn't paste the whole lot . woops sorry:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <defaultDocument>
                <files>
                    <clear />
                    <add value="index.php" />
                </files>
            </defaultDocument>
            <rewrite>
    		    <rules>
                    <rule name="Uploaded Files" stopProcessing="true">
                        <match url="^files/(.+)" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" />
                    </rule>
    		        <rule name="Main Rule" stopProcessing="true">
    		            <match url=".*" />
    		            <conditions logicalGrouping="MatchAll">
    		                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    		                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    		            </conditions>
    		            <action type="Rewrite" url="index.php" />
    		        </rule>
    		    </rules>
    		</rewrite>
        </system.webServer>
    </configuration>
  9. ChrisTorp
    Member
    Posted 4 years ago #

    Yes the blogs.dir is in /wp-content/.

    enjaytee: I'm not sure I understood any of that.

  10. @Chris - he asked "Are you running IIS7?" and everything below that was specific to iis.

  11. ChrisTorp
    Member
    Posted 4 years ago #

    I got that, just aren't sure what IIS7 is.

  12. A Windows server. ;) Instead of a Linux server.

  13. ChrisTorp
    Member
    Posted 4 years ago #

    Oh right. Well, it's not on a local server. But the server runs unix. Anyway, how would it be a server problem? Uploading works perfectly on a normal WordPress install, just not the multiuser version.

  14. tray
    Member
    Posted 4 years ago #

    i'm having a similar issue. (or at least i think so :) )

    i have a feeling that it has something to do with the new wp 3.0 (multisite) now using /wp-content/blogs.dir/ (etc) to host the images instead of a /wp-content/files/ (something or another) directory?

    like chris, i can see the images in my /wp-content/blogs.dir/(etc) folders via FTP, but on the site, they show up as broken images.

    i'll admit, i don't have a good handle on this since i only just got the wordpress MU site running a short while before 3.0 came out. :)

  15. ChrisTorp
    Member
    Posted 4 years ago #

    tray, that sounds exactly like the same issue so I'm sure you do. Could the problem be that while the upload is successful and such that when it comes to getting the image after upload it tries to get the image from /wp-content/files instead of /wp-content/blogs.dir/1/files and so on..?

  16. that's what the rewrite rules in your htaccess file are for. ;)

    they rewrite the actual URL (/wp-content/blogs.dir/1/files) into the one you see in the browser (/wp-content/files)

    Tell your webhost that the htaccess file isn't being read properly.

  17. ChrisTorp
    Member
    Posted 4 years ago #

    This is what says about uploads in htaccess:

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    Should any of that be changed?

  18. riddhishshah
    Member
    Posted 4 years ago #

    Hi
    I am also facing the similar issue but in my case I am able to upload a header image and I can even able to see in ftp folder too but it not showing on front end side.

    I have WPMU 3.0 and I am using Twenty Ten Theme for all my user's blog. But this header image wont show up.

  19. ChrisTorp
    Member
    Posted 4 years ago #

    Same, but it goes for all images that I try to upload. Either it's for a post, page, header, avatar and so on. Just anything uploadable.

  20. riddhishshah
    Member
    Posted 4 years ago #

    Yes you are right it the same issue for all posts, header, featured Images anything. I have the same htaccess file like you.

  21. riddhishshah
    Member
    Posted 4 years ago #

    and if you are using wp 3.0 there is no wp-content/blogs.php file because blog.php is no longer in use as they updated blog with site.

  22. riddhishshah
    Member
    Posted 4 years ago #

    Please try to re-write rule in your htaccess if you are using WPMU 3.0

    wp-includes/ms-files.php

    instead of wp-includes/blog.php

  23. riddhishshah
    Member
    Posted 4 years ago #

    Now it's working for me, but it's still not showing in admin but it's showing it for front end side. Lucky so far!

  24. ChrisTorp
    Member
    Posted 4 years ago #

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    That didn't work for me at least.

  25. @ChirsTorp - do any htacces changes at all appear to have any effect?

    If not, then your server is failing to read the file. Unless you have access to the server itself, then your webhost has to fix it.

  26. lulewittchen
    Member
    Posted 4 years ago #

    had the same issues on my apache server. No uploaded images where displayed since I updated to 3.0
    The new rewrite rule from ChirsTorp worked great for me. Thanks a lot!!!!

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
  27. nborders
    Member
    Posted 4 years ago #

    OK, I need to start over. I believe I have done everything above and with so much info, I fear I'm missing something. So let me give you what I have.

    I'm running on a LAMP environment with the latest version of 3.0

    I have set up the network (multi-site) and I have set up a second-level domain using these instructions successful. (http://www.interconnectit.com/840/wordpress-3-0-multisite-with-multiple-domains-setup/)

    I'm currently working with a new site off of the base installation. The site_ID is "3".

    I have created a directory wp-content/blogs.dir

    Upload path is wp-content/blogs.dir/3/files

    File upload URL is http://www2.mysite.com/files

    Here is my .htaccess file content

    RewriteRule ^index\.php$ - [L]
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    I have uploaded a logo image, and this URL does not work:
    http://www2.mysite.com/files/2010/06/logo-402w.jpg

    However, this one does work:
    http://www2.mysite.com/wp-content/blogs.dir/3/files/2010/06/logo-402w.jpg

    HELP! :)

    ~n

  28. ChrisTorp
    Member
    Posted 4 years ago #

    Well, I tried just removing the .htaccess site all together and it sure noticed it was gone at least.

  29. @nborders - you may be better off using the domain mapping plugin instead
    http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

  30. riddhishshah
    Member
    Posted 4 years ago #

    I modified my htaccess file and change the path as below..

    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    because previously it was with RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    and if you are using WPMU 3.0 blog.php is no longer in use, so far everything is working fine for me.

    did you check your htaccess as well as .htaccess

Topic Closed

This topic has been closed to new replies.

About this Topic