WPMU 2.7 Image Upload Not Working

I’ve looked through the forums here and over at WPMU and none of the suggestions are working. When I try to upload an image, the image is uploaded to an ftp directory of /wp-content/blogs.dir/12/files/2009/03/ and thumbnails are created. But the image can’t be viewed in a post or in the media library. The flash uploader always gives an http error after crunching. Browsing to addresses such as sub.domain.tld/files/2009/03/filename.jpg gives a 404 error. Permissions for blogs.dir and all subs are 775. I’m completely lost and the suggestions I’ve found so far just aren’t helping. The only modification I’ve made the the htaccess file is for the supporter/plugins plugin. Thanks in advance.

  • drmike
    • DEV MAN’s Mascot

    What;s the specific http error you are receiving after crunching?

    Also can you give the specific file name and size of the uploaded file?

    Can you please provide a link to a specific post where a broken image is so we can see what’s occurring?

  • drmike
    • DEV MAN’s Mascot

    The file name is testimage.jpg and it is 99kb.

    That looks fine. Just so you know, try to keep away from file names with spaces and non standard characters (ie $%^&:wink: as those get translated into web safe characters and wp sometimes doesn;t handle them too well. You’ll get 404s and the like.

    And a bit of fooling around with the url of the image doesn’t pull anything up, except for the 404 within the blog. No additional weird directories or trailing slashes or whatnot.

    And you’ve confirmed that the images are there and available.

    Hmmm….

    What;s the ownership of the created directories and of the images?

    Can you post your htaccess please?

  • nbostic
    • The Incredible Code Injector

    All folders are 775 and the files themselves are 664. Here’s my htaccess:

    RewriteEngine On

    RewriteBase /

    #uploaded files

    RewriteRule ^(.*/)?files/$ index.php [L]

    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

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

    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [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-.*) $2 [L]

    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]

    RewriteRule . index.php [L]

    <IfModule mod_security.c>

    <Files async-upload.php>

    SecFilterEngine Off

    SecFilterScanPOST Off

    </Files>

    </IfModule>

    Sorry, I don’t remember the specific error message. As for the error log, only some plugin errors for plugins that have since been deleted.

  • drmike
    • DEV MAN’s Mascot

    Had one of my clients get the “http error” last night. Turned out the file being uploaded was bigger than what was allowed. Check your php.ini for max_file_upload_size or something like that. (I know it;s max_file_something)

    Strange though that it’s only 99kB though. Still something to check.

  • nbostic
    • The Incredible Code Injector

    The http upload error isn’t there anymore. It hasn’t been since my second message up at the top. So I don’t need to troubleshoot the http/flash upload error. I still need to figure out why the uploaded images aren’t displaying though.

  • omgitsrfb
    • Site Builder, Child of Zeus

    I got the same issue. The files upload to the blogs.dir/1/files/2009/06/sanchezgq.jpg but I get the broken link question mark icon when i try to view them anywhere.

    When I ‘view on the web’ through fireftp i get:

    The requested URL /public_html/wp-content/blogs.dir/1/files/2009/06/sanchezgq2.jpg was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    I’ve read through WPMU forums with no luck. Kind of like this thread they just stop with no conclusion. Error logs are clean, contacted pSek re: whether PHP is running in CGI or Apache mode (they said cgi mode) , my blog.dir and subfolders permissions are set to 777 (probably shouldn’t be right?). Don’t know if it’s related but I couldn’t get avatars to show up either at first (they weren’t broken links, they just didn’t display for some reason). But know the one for my admin acct does display. I am running BuddyPress and am on a hosted account until temporarily.

    .htsaccess file looks like this

    RewriteEngine On

    RewriteBase /

    AddHandler application/x-httpd-php5 .php

    #uploaded files

    RewriteRule ^(.*/)?files/$ index.php [L]

    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

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

    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatar.php?file=$2 [L]

    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [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-.*) $2 [L]

    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]

    RewriteRule . index.php [L]

    <IfModule mod_security.c>

    <Files async-upload.php>

    SecFilterEngine Off

    SecFilterScanPOST Off

    </Files>

    </IfModule>

    I really have tried for hours looking for the answer for myself before submitting here. Please advise. Thanks

  • drmike
    • DEV MAN’s Mascot

    Link please to an example of a missing image.

    You do see the file names being different, right?

    edit: It looks like you;re actually having a different problem because you;re not reporting an issue of cruching as note up above. Or are you?

  • omgitsrfb
    • Site Builder, Child of Zeus

    thanks doc,

    1. here’s the link you asked for:

    http://thesportsfag.sportsfags.com/2009/06/13/hey-espn-favrewatch-sucks/

    2. not sure what you mean by seeing the file names being different.

    3. I thought the issue reported above started off the same as mine and then went into separate issue with the flash uploader cause later down in the post it seemed like that issue was resolved but the original issue (like mine) wasn’t. His last post was:

    The http upload error isn’t there anymore. It hasn’t been since my second message up at the top. So I don’t need to troubleshoot the http/flash upload error. I still need to figure out why the uploaded images aren’t displaying though.

    That’s still the issue I’m having (images aren’t displaying), but if I need to start a new post I can. Just let me know. Sorry I thought it was ok just to check for an update here to what seemed like an identical issue. I’m new to this forum so if that’s wrong let me know.

  • drmike
    • DEV MAN’s Mascot

    On ipod. Excuse shortness. You’re looking at sanchezgq.jpg in one example and sanchezgq2.jpg in second. (Damn, that was a bitch to remember) Two different file names.

    On side of road walking to brueggers. Look later if I can get a terminal at th elibrary.

  • drmike
    • DEV MAN’s Mascot

    F’ing library. Thinks it’s a sex/ porn site.

    A couple things I just noticed on your post here.

    – You state that it;s a .htsaccess file. The correct file name should be .htaccess Could you please check on that?

    What’s with all of the spaces between lines? You haven’t edited this file in anything like Word or Wordpad, have you? No garbage copied over but I know if the file isn’t ansi, it won’t be read by the webserver.

    It’s strange that the direct url for the image doesn’t work either:

    http://thesportsfag.sportsfags.com/wp-content/blogs.dir/1/files/2009/06/sanchezgq2.jpg

    Ditto on trying it through the first blog:

    http://sportsfags.com/wp-content/blogs.dir/1/files/2009/06/sanchezgq2.jpg

    Can you go down the list of directories there and see what got created? (ie blogs.dir, 1, files, etc.)

    Can you also make sure that blogs.dir is either 777’ed or owned by the webserver’s user (usually nobody or apache)

  • omgitsrfb
    • Site Builder, Child of Zeus

    Doc,

    1. .htaccess file name was just a typo in my post here.

    2. re: the lines in the file not sure but i copied it from view mode in fetch so that might be the reason why there are lines. the only editor i have used is smultron and it was just to add a line for a plugin.

    3. i have two blogs set up #1 and #21 in blogs.dir. Here’s what got created in both:

    blogs.dir/1/files/2009/05 is blank

    blogs.dir/1/files/2009/06 has sanchezgq2.jpg only

    blogs.dir/1/files/2009/avatars/0 has three files cause i couldn’t get it to work. they are image_1070.jpg, image_10701.jpg and thesportsfag1.jpg

    blogs.dir/1/files/2009/avatars/1 two files thesportsfag1-avatar1.jpg and thesportsfag1-avatar2.jpg

    blogs.dir/21/files/2009/06 has sanchezgq.jpg, sanchezgq1.jpg, sanchezgq2.jpg, sanchezgq-150X150.jpg, sanchezgq-300X300.jpg, sanchezgq1-150X150.jpg, sanchezgq1-300X300.jpg

    that’s it

    4. yes, blogs.dir is set to 777 not sure about the other owners.

    thanks for your help.

  • omgitsrfb
    • Site Builder, Child of Zeus

    Anyone got an idea??? It seems like this issue started by nbostic is the same issue I got, but threads with this issue seem to just die without any resolution.

    Any help would be greatly appreciated.

    There was a suggestion from three years ago over on WPMU forums to update .htsaccess as follows:

    Find:

    RewriteRule ^([_0-9a-zA-Z-]+)/files/(.*) /wp-inst/wp-content/blogs/$1/files/$2 [L]

    RewriteRule ^([_0-9a-zA-Z-]+)/wp-content/blogs/(.*)/files/(.*) /wp-inst/wp-content/blogs/$1/files/$3 [L]

    Replace with:

    RewriteRule ^([_0-9a-zA-Z-]*)/?files/(.*) /wp-inst/wp-content/blogs/$1/files/$2 [L]

    RewriteRule ^([_0-9a-zA-Z-]*)/?wp-content/blogs/(.*)/files/(.*) /wp-inst/wp-content/blogs/$1/files/$3 [L]

    This post was from like three years ago and I thought that maybe this would have been resolved by now so I’m kind of sketchy about fooling around with .htsaccess if I don’t have to. Ideas anyone?

    Thanks

  • mahodder
    • New Recruit

    Same issue here – server using suphp, folders all 777 and correct owner and groups, wp 2.7.1

    You can access this: http://test.yourwizardhosting.com/wp-content/blogs.dir/33/

    But try to open the files folder and you get a 404. I have a support ticket in to the host to see if they can do anything, but open to suggestions till then. :slight_smile:

    .htaccess file:

    RewriteEngine On

    RewriteBase /

    #uploaded files

    RewriteRule ^(.*/)?files/$ index.php [L]

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

    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [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-.*) $2 [L]

    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]

    RewriteRule . index.php [L]

    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatar.php?file=$2 [L]

    <IfModule mod_security.c>

    <Files async-upload.php>

    SecFilterEngine Off

    SecFilterScanPOST Off

    </Files>

    </IfModule>

  • mahodder
    • New Recruit

    I fixed my issue by updating the permission on blogs.php (which one of the rewrite rules were pointing to) to 755, not sure if that got changed during my move to suphp or it wasn’t needed before but it’s all working again!

  • Ovidiu
    • Code Wrangler

    that sounds like usual behaviour to me.

    when installing wpmu or wp on a host using suPhp first I tried 0775 as permissions, but my host would only show me a warning to set the permissions to 0755 :slight_smile: so it seemed natural from then on to automatically set those permissions…

  • wwhite
    • New Recruit

    I have a similar problem.

    I have uploaded the jpg file with a form created by cFormsII

    I can see it at

    http://parkerwhitepruitt.com/tributes/wp-content/blogs.dir/1/files/2009/06/noid-P6185248-500.jpg in the browzer

    I cannot see or assign it in the Media Library

    The owner is apache

    Permissions are 755

    I see that the other files have two other files created in different resolutions.

    Can this be the problem? Is there a way to force the media library to rescan and create the proper files?

    thanks

    wjwjr

  • Andrew
    • Champion of Loops

    Hiya,

    Unless the necessary db entries are added files won’t show up in the media library. The media library doesn’t just scan the files directory for files I’m afraid.

    My guess is that the forms plugin isn’t adding the necessary db entries. That’s just a guess though.

    Thanks,

    Andrew

  • wwhite
    • New Recruit

    Andrew, thanks for the reply

    It seems that when i add a jpg thru media manager

    jquery inserts into

    wp_1_posts with a guid value= (something that isnt exactly the path to the file)

    and a record in wp_1_meta that has

    post_id=wp_1_posts.id and

    meta value = (a part of the correct path) and

    meta_key=_wp_attached_file

    The only options i see are 1. edit the plugin to insert the correct records or

    2. look for a plugin that does what i and looking for (the ability to allow subcribers to upload a jpg for approval and posting by the admin or an editor, that works with the media library…

    Does anyone know of such a plugin?

    thanks

    wjwjr