WordPress.org

Ready to get started?Download WordPress

Forums

Uploaded Pics File Name (3 posts)

  1. mrsticks
    Member
    Posted 7 years ago #

    I have done some searching, didnt find anything that talked about this issue, though I have to doubt I am the first one to notice it.

    I have started using image uploads in my posts. It's easy enough, might as well. But while I was giving my site a once over, I noticed a pic that did not belong where it was. After a few moments, I made the following realization...
    The pic that was wrong, had the same name as another pic that was newly uploaded.
    I get most of my pics from my own collection, from my digital camera pics. So I upload pics named PIC0001.JPG or PIC0006.JPG, I never change the names.
    It just so happened that I uploaded 2 files named PIC0008.JPG in this month ( April ). So it would appear that when I uploaded the 2nd PIC0008, it replaced the first one I had previously uploaded. This wouldnt have been a problem if I had done this in different months, but as luck would have it, they were in the same month.

    This might be an unintended feature, I dont know.

    I might suggest simply renaming the files as they are uploaded. Change the file name to the timestamp, this way they are all unique. Maybe if I get ambitious I will pour through the upload functions and make that hack myself. If anyone shows any interest, I can post back with changes.

    Thanks

    -peter

  2. krypton1
    Member
    Posted 7 years ago #

    Agreed. I just started running into this. I saw slightly different behavior. now instead of the old file being overwritten, it just won't allow me to upload a new image with the same filename, and keeps showing the old image. Would love to see this bug fixed. Thanks!
    Brian

  3. mrsticks
    Member
    Posted 7 years ago #

    I just got around to checking more into this. I am currently on WP v 2.2. The upload functionality is in wp-includes/functions-post.php in the wp_upload_bits(). It was then I noticed that this issue has been addressed. Now, if you upload a file with the same name as a previously uploaded file ( in the same month ), it renames the new upload.
    ie.
    One June 3 you upload FILE.ext
    it gets put into
    wp-content/uploads/2007/06/FILE.ext

    Later on June 15 you upload another ( different contents ) FILE.ext
    this file is put into
    wp-content/uploads/2007/06/FILE1.ext

    This solution works for me.

    Thanks devs.

    -peter

Topic Closed

This topic has been closed to new replies.

About this Topic