WordPress.org

Ready to get started?Download WordPress

Forums

Enable Media Replace
Replaced Files cause 404 error (10 posts)

  1. Aaron Wagner
    Member
    Posted 2 years ago #

    I am running on Windows Server 2008 R2, with IIS 7.5. Content Directory has been moved via the WP recommended method. Here's the process I am going through:

    1. Upload a new PNG file (issue duplicates with JPG files too)
    2. WP Creates 13 imgages, (12 thumbs, and one full size)
    3. Files are viewable in the browser
    4. Replace file with a different PNG file (using just replace file)
    5. Upload works and returns to the media library
    6. Refreshing on the fullsize image on the browser produces 404 error
    7. Examining the filesystem reveals:
      • Thumbnails are updated
      • Full size image is gone

    Attempting this same process with a PDF produces the same results (without the thumbnail creation, of course).

    http://wordpress.org/extend/plugins/enable-media-replace/

  2. alexgophermix
    Member
    Posted 2 years ago #

    I have an image gallery with images and their links set up like so:

    <a href="xxx/wp-content/uploads/2011/11/DSC0133.jpg" rel="attachment wp-att-367">
    <img src="xxx/wp-content/uploads/2011/11/DSC0133-199x300.jpg" alt="" title="DSC0133" width="199" height="300" class="alignnone size-medium wp-image-367" />
    </a>

    When I do a "Just replace the file" using another .jpg file only the thumbnail is replaced, but the link to the full-size file leads back to old image. Shouldn't the plugin change the full-size image as well as the thumbnail version?

    I'm using lightbox that's why I need the hyperlinks to the fullsize images.

  3. Måns Jonasson
    Member
    Plugin Author

    Posted 2 years ago #

    I'm having difficulty locating the cause of this bug. It is most likely due to differences in paths between Windows servers and UNIX servers. I am using WP:s internal functions for locating upload paths, so is there any possibility that you have something extra weird set up on your side?

  4. Aaron Wagner
    Member
    Posted 2 years ago #

    I thought so too, initially, but all my paths are set properly. The replacement of the thumbs happens flawlessly, but the full size image is never created.

    What function are you using to determine the upload path? Maybe I can use that to determine if any paths are indeed incorrect.

  5. Måns Jonasson
    Member
    Plugin Author

    Posted 2 years ago #

    Here is the function call I'm making:

    $current_file = get_attached_file((int) $_POST["ID"], true);

    And then to move the new file to the old location:

    move_uploaded_file($_FILES["userfile"]["tmp_name"], $current_file);

  6. Aaron Wagner
    Member
    Posted 2 years ago #

    If I echo the $current_file after get_attached_file, this is what it gives me:

    C:\inetpub\development/content/uploads/2012/03/Chan-Lawrence.jpg

  7. Måns Jonasson
    Member
    Plugin Author

    Posted 2 years ago #

    Strange, you are getting mixed slashes and backslashes, and this is your problem.

  8. Aaron Wagner
    Member
    Posted 2 years ago #

    Interesting development: Instead of giving me a 404 error on the images, it gives me a 500 (a distinction I must have missed earlier).

    Upon looking closer at the file system:
    From my computer (a remote machine), it does not show the full-size images.
    From the server, it shows them, but any attempt to view them causes an "Access denied" error.

    Digging deeper, The permissions on the original file are getting changed, such that they're not viewable by IIS_IUSRS. If I set it to read and Execute, the file is then viewable.

    In the upload.php file, I noticed that you're using a chmod command (chmod($current_file, 0644)) to change the files permissions. This seems to be the culprit, because commenting it out and trying another replacement allows the process to work properly.

    Perhaps a check for the server OS would be in order to prevent chmod'ing of the file on Windows.

  9. alexgophermix
    Member
    Posted 2 years ago #

    Upon closer inspection, my problem is different from Aaron's and likely not caused by the same bug. I'm running Red Hat 4.1.2 and the problem is not with file permissions but that only the thumbnail image is replaced not the full sized image.

    Should I start a new thread?

  10. eberlyjm
    Member
    Posted 2 years ago #

    Hi Aaron, did you ever resolve this problem? If so, do you have specifics on HOW?
    I'm working on a site that the client is hosting on Windows/IIS and am having a similar problem. The thumbnails are replaced, but the full size image is not. Not only is it not replaced, but there must be some permission errors because my prettyPhoto gallery spits out a message saying the image does not exist. The weird thing is that if I go directly to the image link in my browser, it DOES display the image (although it's the old one) so it must be some kind of permission thing. Unfortunately I do not have direct access to the client's server so cannot take a look at what's going on.
    Any clues?
    thanks
    Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic