New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Strange WordPress issue -- media uploads simultaneously work but don't work. What else can I try?
Just inherited a site that was started 10+ years ago. Moved it to my hosting. Client reports a long-standing issue related to uploading new photos/media files to the media library and I have replicated the issue on a dev copy of the site.
- Open up media library in wp-admin
- Click "add new media file"
- Drag a new file into the drop area to upload it. File appears to upload, shows below the drop area with broken image link.

- Go to Media Library listing in wp-admin dashboard, and see the file that was uploaded (broken link/no thumbnail). Click on any of the options (view, copy URL, download, etc), all lead to a "not found" sort of error. I've also tried installing a couple different image optimizer plugins just to see if they can see the file. All of them report an error message with some variation of "invalid_file_path" or "file not found" message.
- Login to the server via SFTP, navigate to the uploads folder, and the uploaded file and all associated generated thumbnails are there. They download just fine.
So it would appear that the images are actually being uploaded, but there's something within the wordpress ecosystem that's not making the connection between the files on disk and the database.
Here's a short list of what I have tried to do to resolve this issue:
- Changed to a stock WP theme
- Deactivated and deleted all plugins
- Deleted all but about the first 50 lines of the wp_options table in the db in case there was some odd config that was doing something to the upload path or something else strange
- Deleted everything from the wp install via SFTP other than the wp-content and wp_config.php file. Uploaded a fresh copy of WP downloaded from the mothership.
- Deleted all posts and pages on the WP site
- Basically deleted all tables in the database except for the dozen or so that are required, and emptied all tables that I could empty (leaving users / user meta, wp_options, etc).
- Specified the uploads location in wp-config.php with a default value:
define( 'UPLOADS', 'wp-content/uploads' );- Rebooted the server 100 times
- Verified that there doesn't appear to be anything unexpected in the wp-config.php file
- Ensured that all database tables are InnoDB and have collation utf8mb4_unicode_520_ci
WHAT ELSE IS THERE?????????????

Comments
Did you changed your PHP Values? Like this?
hp_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 300
php_value max_input_time 300
As I was writing the last point on my list above, I realized I hadn't checked the collation of the database itself, just the tables. It was set to something strange. So I updated the collation in phpmyadmin for the database itself to be utf8mb4_unicode_520_ci and also used the checkboxes to "change all tables collations" and "change all tables columns collations".
Uploads work now.
How many hours I have spent on this issue, I don't know. But damn glad to have finally figured it out. What a cluster.
What are the permissions and ownership on the wp-content/uploads dir and any files within it?
In wp_options, what is the path set to under the upload_path option?
Try turning on debugging, and see what shows.
Thanks, I missed mentioning that I had already checked permission and ownership on all the directories inside wp-content, and those were as expected. See note above. The issue is finally fixed.
for reference, the database collation was previously set to:
utf8mb4_uca1400_ai_ci
hmmm....reviewing a bunch of other sites I have hosted, they are all basically collated as utf8mb4_uca1400_ai_ci . Tables usually a variety of utf8mb3_general_ci and utf8mb4_unicode_520_ci
Perhaps I'll do a bit more testing on the dev copy to see whether perhaps changing everything to utf8mb4_unicode_520_ci and then changing the database itself back to utf8mb4_uca1400_ai_ci will accomplish the same fix.
looks like switching the database (and all tables/columns) collation to utf8mb4_unicode_520_ci and then just switching the database (not tables/columns) back to utf8mb4_uca1400_ai_ci seems to work just fine. I wonder whether perhaps simply the act of writing new collations cleared up some ancient flipped bit or something and was less related to the collation itself.
At any rate, I think I'm now ready to take a full backup of the site from the production server and attempt the collation change exercise to hopefully get this working again.
This kind of strange behavior usually points to broken file paths or MIME type issues not syncing between WordPress and your server setup. Since you've ruled out core files, themes, and plugins, here are a few more things you might try:
Check .htaccess rules – a misconfigured .htaccess can cause media URLs to fail loading.
Verify upload path in database – in wp_options, check upload_path and upload_url_path for any legacy or incorrect values.
File permissions – make sure the uploaded files have the correct permissions (e.g., 644) and folders are 755.
Media URL mismatch – open your browser’s developer tools to verify the full media URL. If the domain/subdirectory is wrong, WordPress might be misreading the upload URL.
Try regenerating thumbnails – use a plugin like “Regenerate Thumbnails” to refresh attachment metadata and paths in the database.
Attachment metadata – WordPress stores file data in wp_postmeta. If that’s corrupted or missing, the media appears broken despite being on disk.
If all else fails, try uploading a file manually via SFTP and using the “Add from Server” plugin to import it. This may help reset the metadata WordPress needs to read images properly.