The MU forums have moved to WordPress.org

Wrong URL of my Media uploads. (41 posts)

  1. drogomoss
    Member
    Posted 14 years ago #

    Hello again. :-)

    I encountered another problem. When writing posts and I want to upload images... it appears as a blank box in the editor. The files get uploaded to the right directory but it is not displayed properly.

    Here's a sample of a file link generated:

    http://nothingmatters.kabaliwan.com/blogcamp/files//home/kabaliw1/public_html/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/P8302641.JPG

    So if I rearrange it to the write path:

    http://nothingmatters.kabaliwan.com/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/P8302641.JPG

    and put it directly on the browser I still get a 500 error.

    Aside from this everything works perfectly. What could I be missing here? Could it be the rewrite in the .htaccess file?

    Thanks a lot,

    Drogo

  2. drogomoss
    Member
    Posted 14 years ago #

    Here's the error I get:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

  3. andrea_r
    Moderator
    Posted 14 years ago #

    ". When writing posts and I want to upload images... it appears as a blank box in the editor."

    A blank screen anywhere means an error. Chances are it didn't even get uploaded. Check permissions on the blogs. dir folder.

  4. drogomoss
    Member
    Posted 14 years ago #

    The media file got uploaded. Permissions are 755. :-)

  5. drogomoss
    Member
    Posted 14 years ago #

    Hello All.. (more observations. some of the directories below are not the actual ones but only for illustration purposes only)

    (x) = http://nothingmatters.kabaliwan.com/blogcamp/files/
    (y) = /home/kabaliw1/public_html/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/testimage_file.JPG
    (z) = (x) + (y) = http://nothingmatters.kabaliwan.com/blogcamp/files//home/kabaliw1/public_html/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/testimage_file.JPG

    When ever media files are loaded using the 'ADD NEW" in the dashboard or in the editor, they are saved in this location (/blogcamp/contented/wp-content/blogs.dir/2/files/). Uploaded files are uploaded in the correct location.

    The problem now is that when you edit or view the image or media file it it shows the location as (z) (see above). I am thinking it has to do with my .htaccess file rewriting the URLS incorrectly because it showing the url location + the actual location. But then if this is so... why then were the media files uploaded in their rightful locations?

    Note that the directory /files/ in (x) does not exist. The correct location of an uploaded file should be: ( http://kabaliwan.com/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/testimage_file.JPG ), but entering this on the browser bar does not show the image.

    Does anybody have nay idea why this is happening? :-)

  6. drogomoss
    Member
    Posted 14 years ago #

    After much hair pulling... (y) is using the WPMU absolute path. What I am trying to find out now is where did (x) come from when /blogcamp/files/ does not exist.

    Can anybody point me to were this is configured? Accessing the image file (http://kabaliwan.com/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/testimage_file.JPG) directly from the browser returns an Internal Server Error.

    Any inputs?

  7. rsgrone
    Member
    Posted 14 years ago #

    Well this much I can tell you:

    After many hours, and loss of many forehead follicles, I was able to actually able to get MU wot run on a microsoft Web Server 2008

    could you be a bit more specific about which platform you are using?

    I noticed that your url is incorrect (I think) since MU so conveniently throws the directory path /blog/ blog into any url, excuse me, permalink I visit while viewing a post (which is fairly strange since I named the folder/directory to where I place mu 'news')(so much for attempting to make the site url professional looking) anyway, you will need to look at the web server config file (not getting specific here).

    I got so frustrated with mine, I simply reimaged the server. I built my we site out (html pages) included a directory called 'news' not 'blog' or any variation of said same (for everyone states this causes mu to have a heart attack if it sees to many 'blog(s)' in the permalink, I don't doubt it) and everything was working okay except, at that time I could not upload avatars (which was just the opposite of what problems I was having).

    So there I was back at it, trying to get the privileges straightened out to upload avatars into a folder called /avatar (as per defualt useage) and whammy the entire install crumbled like a stale cookie in a crying babies hand. I mean good lord people.

    I gave up, created a separate folder, created another web on a separate IP, and reinstalled MU. I am only having minor video upload problems at this time. I am simply considering standing up a media server for those to use and not worrying about this anymore.

    What occurs is, that in the wonders of this "url rewrite" process, the configuration of the web server file becomes so convoluted, that it would take months to straighten it out by hand (at least on a windows box).

    So the morale of this story is, place MU all by its' lonesome and hope for the best, DO NOT ALLOW any folders to INHERIT PERMISSIONS FROM ANYWHERE this is hazardous not only to your web server but your mental health as well, (See Surgeon Generals Posting on MU and Mental Health)

    Good luck, Andréa is correct, about the permissions, and to point out, on the windows box, this /blogs.dir/ directory (god knows hy they named it that) will appear as a FILE if you have completely kludged the web conf/permissions up, and halt right there thinking that the "sub-directory" is actually a file that it is looking for.

    It's pretty much the same thing that happens when users start using two hyphens in a row or an apostrophe or / \ in the title of their article. WordPress whilst creating the permalinks, forming the permalink from the title of the "post" does not treat special characters in a title any differently than they would during directory or file creation.

    Unfortunately, now all my listings in Google, etc point to an non-existent "blog" and I am busy sending spiders out to correct this problem as well. The bad thing is that, I had somewhat of an ad campaign going out, using my .com address and now I have MU on my .net address (pouring good money for bad I suppose)

    Good Luck

  8. andrea_r
    Moderator
    Posted 14 years ago #

    Ooooo, yeah. Windows box stuffs up things quite good.

  9. rsgrone
    Member
    Posted 14 years ago #

    So Andrea,

    How is it that I can change that default /blog/ they throw into the permalink to say /news/ instead?

    I mean it shouldn't be that difficult, with the "Pretty Urls" thingy you folks have going.

    I noticed inthe "customize" your url filed for permailinks the /blog/ appears twice. Can't that be change to something other than letting the world know that this is a "Blog"?

  10. drogomoss
    Member
    Posted 14 years ago #

    thanks Rsgrone. My Mu installation is hosted in justhost.com

    I'm still in the process of debugging... hahahahha

    Was wondering about this in "location of the uploaded file": /files//home/ notice the two back slashes.

    I have already (hopefully correct) boiled down the problem to the .htaccess. I've read lots of post here and well being on a shared host they actually didn't work.

    I did like almost several reinstalls while holding the blog at backup. And I noticed that everything is OK just as long as you do not rename or move the wp-content folder. This is the main reason why I concluded that the .htaccess is at fault as it is partly responsible for rewriting the urls.

    I've already done so many revisions of this .htaccess and still the error occurs. Well the file actually gets uploaded to the correct folder and location BUT the backend interface returns a messed up URL which the editor cannot use.

    As a last resort I may just have to go with the default location and name of wp-content just to make it work. But this issue will bug me for a long time until it gets solved. :-)

    So now I'm trying to understand how the code in .htaccess works. And well I'm down to my last hair. LOL.

  11. rsgrone
    Member
    Posted 14 years ago #

    .htaccess mainly tells the program to drag index.php around with it (vice versa)

    Php unlike .html will not work unless it knows where the index.php file is

    The best way to get familiar with this whole process is go out and get "CodeIgniter" I believe is the name of the program.

    Watch a tutorial or two. You will then say, "Ah, that's how they did this"

    Trust me, I was to the point of just simply writing my own code but was under a tight "time-line"

    Had I a team of programmers and the like on this project then, well who knows if I would even be here right now :?)

    P.S. I use a dedicated hosted server, so I am free to destroy it, make it work, or simply shut it off, as long as I pay them

  12. drogomoss
    Member
    Posted 14 years ago #

    I'll see this program. Every little bithelps. :-) For now a 1 hour nap is in line... it's 3AM here and still no light at the end. Thanks rsgrone.

  13. andrea_r
    Moderator
    Posted 14 years ago #

    @drogomoss - since it was giving you a white screen of death, that means erorrs. Did you check your error log yet?
    Have you disabled ALL plugins (including thsoe in mu-plugins) then uploaded a picture again?

    The .htacces controls pretty much every link. If you can see the permalinks on posts, but not the images, then something on the server (a setting, a plugins) is interfering.

    "How is it that I can change that default /blog/ they throw into the permalink to say /news/ instead?"

    By default, without hacking? You can't. :) There is a plugin out there (paid) that will remove the /blog/ portion for you.

  14. blogsterfiles
    Member
    Posted 14 years ago #

    Getting back to the topic, "Wrong URL of my Media uploads," My wpmu installation was running fine (as far as this problem goes) until upgrading to 2.8.4a.

    My user images, user avatars and group avatars display in IE as place-holders only instead of rendered images. The new wpmu is great! It seems to place files differantly than earlier versions, but this is NOT the problem. The problem is that nested directories cannot be generated by wpmu, and certain existing directories cannot be seen by browsers below the "files" folder.

    In example, with permissions and ownership confirmed correct, and a user avatar image located at ...wp-content/blogs.dir/1/files/avatars/20/abc.jpg, it is still not visible to the browser. Moving the image up the tree produces the same result until you place it in ...wp-content/blogs.dir/1/abc.jpg.

    Testing with other images, it turns out anything in "files" or below, ".../files/path/" is not seen by browsers, thus is not seen in any wpmu rendered page.

    I am thinking this is an apache problem but caused by a wpmu bug. Until such time as you find the bug, can it be cured with an .htaccess command that forces Apache to serve the directories/media?

    This blog is running on a Linux VPS, the directories and images are present in fine fettle, all permissions and ownership have been checked and rechecked, and all worked fine before.

    Sorry if I've gone on too long, but I have seen this reported over and over, and it has been attributed to "wrong platform," "wrong permissions," "wrong ownership," etc., but NEVER have I seen anyone cure the problem. It has to be a MAJOR issue with wmpmu, isn't it? One more clue... This is NOT a problem on my shared servers (same upgrades and plug-ins), but I can't run sub-domains there.

    Thanks ever so much in advance if you can help! :)

  15. andrea_r
    Moderator
    Posted 14 years ago #

    "It seems to place files differantly than earlier versions, "

    They've always been placed in the same spot.

    "can it be cured with an .htaccess command that forces Apache to serve the directories/media?"

    No. you'll have to find what's going on in Apache.

    "but NEVER have I seen anyone cure the problem."

    In each of those cases, it was different issues.

    "It has to be a MAJOR issue with wmpmu, isn't it?"

    Not if we can't reproduce it. You already stated it works on your shared server. on a different server, it doesn't. The type of install (subdirectories or subdomains) has no bearing on where the files are uploaded

    Good hunting down to find it won't read down through the nested folders, though. that IS a clue.

    Yes - it's frustrating as hell, I know. But we can't see all your settings on the entire server. I know there have been times we've helped people with an issue here int he forums, the thread is long and convoluted with many people trying to help - and the OP comes back with a "Oh, I forgot to mention this.." and it turns out it was some obscure thing nobody would have thought of that didn't relate that the OP went and did themselves.

    :)

    And sometimes (since it's ramble day) an upgrade will highlight issues with the server / host / settings / old plugins where people think it's MU, but the reality is the issues was pre-exisiting and people didn't notice, or it was working somehow.

    Now - since it's uploading avatars, what Avatar plugin are you using?

    And, have you compared the specs on this server to the shared host installs that DO work?

    Is there a chance you hit the 32,000 folder limit on the server?

  16. drogomoss
    Member
    Posted 14 years ago #

    Have not solved it yet.

    But for those willing to recreate the error here are the steps.

    Using a shared hosting. Mine is JustHost.com (unlimited everything except that you can't upload anything greater than 10mb)

    1. Under /public_html create a folder of your choice e.g. wordtest
    2. Copy the MU pre install files here.
    3. The install mu with subdomains
    4. Now with Mu installed. Gointo admin and create a new user e.g. 2nduser
    5. set this user to admin
    6. remove the admin user as admin and reduce it to subscriber
    7. At this point 2nduser is the true admin of wpmu
    8. Now create a folder inside /wordtest e.g. /word-mu
    9. move the entire wp-contents inside
    10. move the wp-content.php to /home/yourdomain just above /public_html
    11. rename it to wp-secret.php and add the following lines:

    define( 'UPLOADBLOGSDIR', $_SERVER['DOCUMENT_ROOT'].'/wordtest/word-mu/wp-content/blogs.dir' );
    define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wordtest/word-mu/wp-content' );
    define( 'WP_CONTENT_URL', 'http://yourdomain.com/blogcamp/wp-innards/wp-content');

    define( 'WPMU_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wordtest/word-mu/wp-content/plugins' );
    define( 'WPMU_PLUGIN_URL', 'http://yourdomain.com/wordtest/word-mu/wp-content/plugins' );
    define( 'MUPLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/wordtest/word-mu/wp-content/mu-plugins' );

    12. then in /wordtest , create a new wp-config.php with the folllowing line:
    <?php include('/home/yourdomain/wp-secret.php'); ?>

    13. Now everything is set.

    14. create a new blog

    15 go to dashboard of newblog as 2nduser

    16 Go to media files and upload an image

    17. check the file locatio and you'll see the error

    18. Try posting it... you can select the image from the gallery but it does not have an icon.

    19 blank squares appear on the post

    20 BUT if you go to the location, file was uploaded correctly

    ###

    Please send updates. Meanwhile, I continue debugging...

  17. andrea_r
    Moderator
    Posted 14 years ago #

    Just a note: nowhere in your previous posts did you mention you changed the default location of the uploads folder.

    That was important. :) The thread could have been much shorter.

  18. drogomoss
    Member
    Posted 14 years ago #

    I think it was on my 5th post. But it was not mentioned as such. Actually I should have posted the steps to replicate it earlier and it would have made this thread short. :-)

  19. blogsterfiles
    Member
    Posted 14 years ago #

    @drogomoss ..you said:

    "The correct location of an uploaded file should be: ( http://kabaliwan.com/blogcamp/contented/wp-content/blogs.dir/2/files/2009/10/testimage_file.JPG ), but entering this on the browser bar does not show the image."

    If you replace the image with, say, a text file (i.e. test_file.txt), or anything other than a graphic image, does it then show up in the broweser? That is what I've discovered to be the case.

    @andrea_r
    It probably is my fault, and I'm happy to take the blame, I just need to find an answer. And I need for it to work on both shared and VPS servers. Also, it seems to me it doesn't matter if you can reproduce the problem since it is reproducing itself all over the place.

    I realize there are many problems caused by many things (mostly users), but the one common denominator here, that seems to never get resolved is where it comes down to this statement "After the upgrade, no existing images are displaying." (I've noticed it is not just the 2.8.4a upgrade but pops up at the instance of "upgrade" in general.)

    The above quote is from this thread: http://premium.wpmudev.org/forums/topic/uploaded-images-problem-after-281-upgrade ...and the final answer from Andrew was "That means the .htaccess file isn't doing it's job for some reason. Ask your host to take a look. Maybe they can spot the problem."

    This is why I asked you about .htaccess. I have a service ticket in with my host (Network Solutions) but no answer so far. They usually tell me it is a wordpress issue and wordpress says it is a server issue. Anyway, wherever it originates, there seems to be many many many people having unresolved problems with images that are not rendered in browsers where wpmu is installed.

    I hope I don't sound snarky. I don't intend to, if I am. It is purely clinical to me.. I just want to keep going until I find an answer, and I am very aware the odds are it is a knowledge defecit on my part at the center of it all. But mine, or not, I still just need to find the answer. Maybe if someone can look for a common elimentat in all these seemingly isolated incidences, many problems will be solved with one solutiuon found! Anyway, thanks again for your help and patience.

  20. drogomoss
    Member
    Posted 14 years ago #

    Nope it doesn't show up in the browser. But it gets uploaded to the right location. Tis .htaccess not working properly when wp-content is moved away from its original location. :-)

    No solution yet.

  21. tim.moore
    Member
    Posted 14 years ago #

    blogsterfiles: can you answer Andrea's questions, quoted below? We might be able to help with some more info.

    Now - since it's uploading avatars, what Avatar plugin are you using?

    And, have you compared the specs on this server to the shared host installs that DO work?

    Is there a chance you hit the 32,000 folder limit on the server?

  22. andrea_r
    Moderator
    Posted 14 years ago #

    Also, in steps 11 & 12, you moved a file up outside the web accessible folder and renamed it. Try the same *without* renaming it.

  23. drogomoss
    Member
    Posted 14 years ago #

    Just did it and it returned:

    Fatal error: Call to undefined function wp() in /home/kabaliw1/public_html/blogcamp/wp-blog-header.php on line 21

    Thanks Andrea I just got an idea from you post... :-)

  24. EternalSkyChaz
    Member
    Posted 14 years ago #

    Seems to me like the best thing to do is to let the admin of a specific blog set where any kind of media files (pics, videos, music) are stored and allow the user the options of having WPMU upload the files (a very bad idea) OR ftp the files up (works flawlessly).

    Even better yet, forget having WPMU upload files at all. There are some excellent FREE ftp programs out there and he amount of extra effort required to upload a file via ftp is nil and worth the lack of hair pulling to upload via WPMU. There is also a Firefox plug in that allows you to ftp files.

    Why re-invent the wheel?

  25. drogomoss
    Member
    Posted 14 years ago #

    Hello Eternal. A good idea. But if the folder resides within the WPMU directory, as I have tried, the files get uploaded but the link used by the front end is messed up. Which is the reason why the file icons do not appear in the library nor in the posts when inserted. :-)

  26. EternalSkyChaz
    Member
    Posted 14 years ago #

    Yes, drogoss, but the issues you are having is because WP and WPMU have become too large and are trying to do too much. They need to simplify the code and make things simpler for everyone, WP programmers and users alike.

  27. andrea_r
    Moderator
    Posted 14 years ago #

    I kind of disagree with that, as not everyone is going to be uploading HUGE media files all the time. :)

    Saw mention of a plugin that will allow you to easily change the upload directory for blogs. Not sure how well it works or what it's called, but I know others have had success with it.

    It may be in this case, on this server, moving the directories around just isn't going to work (for whatever reason). Hardening the folders via permissions & ownership should be sufficient.

  28. blogsterfiles
    Member
    Posted 14 years ago #

    @tim.moore
    I'm using Author Avatar List Version 0.7.4

    I can't tell you what is going on with the shared server because I don't have access to server settings, but I'll email tech support and ask if they can provide details. They support a flawless wp instal but won't/can't help with wpmu, so I could not use sub-domains there. This is why I want to use the VPS server.

    I have lost almost all of my users (down to a about a dozen now), so I doubt I'm up against the 32,000 limit. Last night, I deleted all the user accounts and directories, and wiped the mu install, then did a brand new instal, which got rid of a bunch of problems, like rss feeds not working in dashboard, etc., but the image problem still exists. I have a paid tech guy looking at it now. This is what he has told me so far:

    This line in the .htaccess file

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

    This reroutes anything requested in a files folder to the blogs.php file which is supposed to output the file.

    This is why you can't pull up an image file directly. If I comment this line out of .htaccess it works on the main site but not for domain aliases.

    Waiting now for more from him, or help from anyone who can. Thanks to all who are trying as this is clearly over my head.

  29. brianwc
    Member
    Posted 14 years ago #

    I think I have the same or a similar problem. I also changed the uploads directory during installation, and when one uses Media Uploader it creates a broken link to the files in http://example.com/uploads/mycustomname/mediafile.jpg but I can only access the files by going to http://example.com/wp-content/uploads/mycustomname/mediafile.jpg

    How can I tell Media Uploader to add the "wp-content" to the URL it generates or alternatively, how can I tell Apache to pull requests to http://example.com/uploads/mycustomname/mediafile.jpg

    from http://example.com/wp-content/uploads/mycustomname/mediafile.jpg ?

  30. gulflee
    Member
    Posted 14 years ago #

    hey ... i got it works,
    a very simple solution just rename the htaccess.dist to .htaccess thats it now i can see the thumbnail after upliad and every things works fine
    the url did not change (subdomain.domain.com/files/2009/10/images.jpg) but the .htaccess now works now (http://premium.wpmudev.org/forums/topic/uploaded-images-problem-after-281-upgrade) the image show well

About this Topic

  • Started 14 years ago by drogomoss
  • Latest reply from omgitsrfb