Tips for Updating an Existing File

The problem

When you upload a file a second time to WordPress, the second version does NOT overwrite the first version, it gets saved under a different name.

In the following example, we’re discussing a pdf, but it could be an image, or any other type of file.

Let’s say you have a file called cheeses.pdf which you have uploaded to your WordPress site. You’ve made updates to the pdf on your computer, and now you want to update the website version as well. When you upload your new cheeses.pdf, WordPress will see that you already have a file of that name in your media library, and name the new file cheeses-1.pdf.  This behavior is usually helpful because it prevents you from accidentally overwriting files, but in the case, that’s what you WANT to do. If the updated file is renamed to cheeses-1.pdf, none of the links on the site will point to it – they will still be pointing to the old cheeses.pdf.

The workaround

Delete the old before uploading the new

After checking that the filename of the outdated file is the same as the new one you’re about to upload, delete the old pdf from your WordPress media library (this can be done either through the media upload interface on your page, or in the media library). Only after you delete the old file, upload the new one. With the old file gone, the new file will not be renamed, and the links on your site will not need to be updated.

Upload on your page/post not your media library

Make sure to upload files to your page/post instead of to your media library (i.e. drag the file into your visual editor, or use the media upload button while editing your page). When a new file is uploaded to a page, it will be put in the year/month folder that corresponds to the page’s creation date, rather than the year/month folder that corresponds to the file upload date. A link to a uploaded file has a URL like this: http://wordpress.williams.edu/files/2014/11/cheeses.pdf – using this method will keep the blue part of the URL from changing.