File Name (Added 1)

  • Author
  • #346712


    We’re having a little bit of an issue with uploading files. You see, when we upload a file, the first time it’s all fine and dandy. Unfortunately we always read back and find ways to improve whatever it is we have uploaded, so we delete the old file and attempt to upload something with the same name. This is where the problem appears: we get the file name of whatever it was with an added 1 at the end. This isn’t the most horrid thing that could happen, but as we’re releasing something that we want others to be able to view easily by sorting by name (in their computer menu) it could cause trouble. We’ve tried deleting the old file and waiting a couple days, and still we get that blasted 1. I have searched around but haven’t had much luck in finding and answer, so this is the best bet I have. Any help would be appreciated. Cheers.

    The blog I need help with is


    Moderator Emeritus

    That is what happens when you don’t rename a file that you have previously uploaded. I don’t know if the problem persists forever, or just for a long time (weeks??months?? while all servers update…)
    With an image file, once it’s been uploaded into your media library, you can rename it so that when a reader hovers over it the new title will show. Also, search engines will find your renamed title. In your media library, however, the file will still have the 1 added. To avoid confusion on your part, don’t upload images (or pdfs etc) with only numbers for names.
    My experimentation has been limited to images, so I’m not sure about other types of files, but I’m assuming this would apply.


    @tamartinez: You can only sidestep that if you upload the new version weeks after deleting the previous one.

    (@Tess: Since you prompted me, your opinion please: First batch ready, all suggestions welcome – including improving my English!)


    First scenario

    A file is deleted from the media library and then a new one with the same name is uploaded shortly after that.

    All posts, pages, etc. that we make on our blogs are kept in a MySQL database as are the names of all files that we upload (images, videos, audio files, Word documents, etc.). With databases, what happens is that if you delete something, it is not immediately deleted, it is “marked” for deletion and is then no longer available. On some preset schedule, the database software “packs” the database and all the stuff “marked” for deletion is then removed. This is done to conserve server resources and is especially important when you have very large databases such as those at wordpress.

    If you delete a file from your media library, it does not immediately go away as I said, but is marked for deletion. If you try to upload a file with the same name, the database will not let you because even though it is a new file, and the old one of the same name is marked for deletion, the database will not allow that file to be over written and so it ads a number to the end of the file name.

    Second scenario

    A file with the same name exists in the database from a previous upload and is not deleted. Then a new file with the same name is uploaded.

    WordPress will not overwrite an existing file in your media library. What it will do is upload the new file with the same name and put a number after it thus preserving both.

    If you think about this, it is a good thing. Perhaps you mistakenly name a new file for upload with the same name as an older upload, and if they allowed overwriting, you could overwrite an older file that was important and possibly not something that could easily be recreated (perhaps it was accidentally deleted from your computer).

    Now this situation could be handled a little differently and when wordpress detects the fact that you are trying to upload a new file with the same name as one that already exists in your media library, they could put up an alert box and give you the choice of overwriting the file, or changing the name. While this may sound like the perfect solution, I have been called on many times when someone has overwritten a file on their computer “by mistake” even though this type of warning came up and because they were not paying attention, they just said OK. Result: Old file gone. In some instances I’ve been able to recover the file if they call me right away and do not do anything else on their computer, but if they don’t notice for a few days or a week, there is little chance of recovering it.


    Moderator Emeritus

    You have been working hard! It’s 1/30 am for me and I have to work tomorrow but I’m so happy to see that!!



    Yea, I’m fully aware of the fact that it won’t be deleted immediately, and I mentioned that I had waited a couple days and tried but to no avail. What I’ll try doing, then, is what panaghiotisadam recommended. If worse comes to worse I can just come up with a new file name for the series that can still be alphabetized in correct order when sorted. I was wondering, where can I check to see when these “pack” deletions will take place? Thanks much.

    I tried that a couple days ago, and it doesn’t actually change the file name when it’s downloaded. You did say, though, that it only changed what was seen as a title and what could be found when searching. Also, I don’t have all numbers as a file name but rather 3 letters and then (originally) 2 numbers. What I can probably do is swap that and put the numbers first, then the letters afterward. In theory that will still make it alphabetize when someone sorts it.

    Thanks to all for responding.

The topic ‘File Name (Added 1)’ is closed to new replies.