WordPress.org

Ready to get started?Download WordPress

Forums

Images are not uploading into correct file (43 posts)

  1. Chuck
    Member
    Posted 3 years ago #

    I tried posting at http://wordpress.org/support/topic/images-are-not-uploading-into-correct-file?replies=12 a couple weeks ago and have gotten no repsonse from anyone so I'm trying a new thread.

    I've tried the "3 step" method shown at http://wordpress.org/support/topic/images-are-not-uploading-into-correct-file?replies=12 and my results are:

    EXAMPLE - http://cooking.thefrazzledmama.com/wp-content/blogs.dir/11/files/2010/08/ezmuffins11.jpg
    LOADS FINE - http://tbfaa.devsite103.com/wp-content/blogs.dir/2/files/2010/06/meeting.jpg

    EXAMPLE - http://cooking.thefrazzledmama.com/files/2010/08/ezmuffins11.jpg
    NO LOAD - http://tbfaa.devsite103.com/files/2010/06/meeting.jpg

    I've tried both the existing .htaccess file (below) and the .htaccess file provided without successful loading of images.

    This is how it appears on the page when I switch to the HTML view - <img class="alignleft size-full wp-image-917" title="meeting" src="http://tbfaa.devsite103.com/files/2010/06/meeting2.jpg" alt="" width="94" height="63" /> However if I try to access the image in my browser I get a Page Not Found message.

    I've checked and my browser WILL load http://tbfaa.devsite103.com/wp-content/blogs.dir/2/files/2010/06/meeting.jpg

    http://tbfaa.devsite103.com/files/2010/06/meeting2.jpg"><img class="alignleft size-full wp-image-917" title="meeting" src="http://tbfaa.devsite103.com/files/2010/06/meeting2.jpg" alt="" width="94" height="63" />

    Any ideas or suggestions? This stuff is way over my head so any help will be greatly appreciated.

  2. It's 100% to do with the ,htaccess file and mod_rewrite. They are going to the right spot, where they are supposed to on the server. the rewrite rule is either not being read correctly, isn't in there right, or mod_rewrite is failing to read the file.

    this is the rule:

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    It has to be there. When you set up the network, the htaccess rules that are given are to *replace* the ones you had, not be added at the end of the file. Make sure you did that.

  3. Chuck
    Member
    Posted 3 years ago #

    Thank you for responding. I know nothing about this stuff, and you were working "blind". I tried and failed. Below are the before and after htaccess files. Can you take a look and tell me what I'm doing wrong please?

    BEFORE

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

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    AFTER "my interpretation of your suggestion"
    # BEGIN WordPress

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

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

  4. Corrected .htaccess for ya!

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    Try that and see if it works.

  5. Chuck
    Member
    Posted 3 years ago #

    Thank you for the rapid response. Still no success.

  6. Interesting.

    http://devsite103.com/wp-includes/ms-files.php?file=/2010/06/meeting2.jpg gives a 404 as well.

    Are you using domain redirects or just subdomains for your site?

  7. Chuck
    Member
    Posted 3 years ago #

    Just sub-domains for now. I'm planning on changing to domain redirects after the site is complete and functional. Thank you so much for helping.

  8. Chuck
    Member
    Posted 3 years ago #

    I would be happy to give you access as admin if it would help you to find the problem. Email me chuck@cybersearch-us.com.

  9. Wouldn't help :)

    Can you check, on FTP, if the ms-files.php file exists in the wp-includes folder?

  10. Chuck
    Member
    Posted 3 years ago #

    Yes, it's there. Thanks

  11. Okay, back to basics. Turn off your plugins! :)

  12. Chuck
    Member
    Posted 3 years ago #

    Ok. I've turned deactivated them all. No change. Tried adding a photo and while the space is there, the photo isn't.

  13. EXAMPLE - http://cooking.thefrazzledmama.com/files/2010/08/ezmuffins11.jpg
    NO LOAD - http://tbfaa.devsite103.com/files/2010/06/meeting.jpg

    These are on the same server and network setup, right?

    You don't have any weird hotline protection setup, do you?

  14. Chuck
    Member
    Posted 3 years ago #

    Yes, both on the same server and network. I don't know what a "hotline protection setup" is, but I don't think I have one.

  15. RickA99
    Member
    Posted 3 years ago #

    I think I am experiencing a similar problem. When I add an image to the native Gallery, it places this code in the post:

    <img src="http://mywebsite.org/files/2010/09/grand-prix-large-300x185.jpg/grand-prix-large-300x185.jpg" alt="" width="300" height="185" class="aligncenter size-medium wp-image-383" />

    BUT, the image is not located there. It is located at this address:

    <img src="http://mywebsite.org/wp-content/blogs.dir/2/files/2010/09/grand-prix-large-300x185.jpg" alt="" width="300" height="185" class="aligncenter size-medium wp-image-383" />

  16. That is not a problem, that's what WordPress is supposed to do.
    It not showing is the issue - which is entirely to do with the .htaccess file and your server reading it.

  17. RickA99
    Member
    Posted 3 years ago #

    I am aware of the correction to the .htaccess from ipstenu above. Does it apply in my case as well or do I need to edit it further? Is so, what do I use?

  18. Does your .htaccess look like the one Ipstenu posted?

    Edit: oh wait, is this the actual url it spits out? Or did you mistype it?

    http://mywebsite.org/files/2010/09/grand-prix-large-300x185.jpg/grand-prix-large-300x185.jpg

    with the duplicate image filename?

  19. RickA99
    Member
    Posted 3 years ago #

    I think this is the relevant part:

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

  20. Yep, you;ve got a whole group in there. Did you upgrade from wordpressmu?

  21. oddclicker -- I meant hotlink protection. Hotline protection is what I need when I get phone calls at work...

    Also, are you using a domain mapping plugin or are these separate MU installs?

  22. RickA99
    Member
    Posted 3 years ago #

    This was an MU install from about a year ago. I recently got some renewed interest in it and upgraded it to 3.0.1

    I am not using a domain mapping plugin. Not sure how to answer the question about separate MU installs. I have just one with two sites.

  23. RickA99
    Member
    Posted 3 years ago #

    Oops! I cross-stitched the threads. Disregard my second paragraph. Sorry.

  24. Okay, so this is an MU install and you ARE using a domain mapping plugin? Which one?

  25. I think this is the relevant part:

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

    In another thread, another upgraded from mu user removed the first two lines in this group and it worked fine for him.

  26. RickA99
    Member
    Posted 3 years ago #

    OK, I made the changes so it looks like this:

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

    But, images are still not getting the right address.

    What about this section of .htaccess?

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

  27. RickA99 - Are you using Subdomains or subfolders? The htaccess files are different. :)

  28. RickA99
    Member
    Posted 3 years ago #

    subdomains

  29. Righto, try this htaccess file:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    Make sure you've pulled out everything else from your old wpmu htaccess. If you have other edits to the .htaccess file, you should temporarily take them out. Let's just use the default for a moment :)

    (FYI - I am a HUGE proponent of leaving in comments in your .htaccess file so you can later go 'Oh right, I added that to fix this...')

  30. RickA99
    Member
    Posted 3 years ago #

    The apparent image location looks like this:
    http://path/files/2010/09/grand-prix-large-300x185.jpg

    But the actual storage location is this:
    http://path/wp-content/blogs.dir/2/files/2010/09/grand-prix-large-300x185.jpg

    And everything is now connecting up! Thanks so much.

Topic Closed

This topic has been closed to new replies.

About this Topic