The image uploads. The progress bar fills. And then: Failed to insert file info to DB.
So the file made it — it's probably sitting on your server right now — but the listing doesn't show it, because the part where the system records “this image belongs to this listing” didn't happen. The photo got delivered to the building, but the front-desk log where it gets checked in is broken, so as far as the site's concerned, the image isn't really here.
That distinction is the whole key to this error. Uploading a file and recording the file are two separate steps. The upload worked. The database write failed. So you stop looking at your upload settings and start looking at the database.
The usual reasons that database write fails:
- The table it's writing to is corrupt or crashed. Directory plugins keep their own tables for things like listing images and attachments. Tables can crash — especially older MyISAM ones — and when the target table is broken, every insert into it fails. This is the single most common cause, and the fix is to repair the table (most hosts give you a “repair database” option, or it's a one-line job in the database tool).
- A plugin update didn't finish its database changes. The plugin updated its code but the matching update to its database structure didn't run, so the code is trying to write to a column or table that isn't shaped the way it expects.
- The disk is full. If the server's out of space, the file might squeak in but the database can't write. Worth a 30-second check, because it's embarrassing how often this is it.
- The database user lost permission to write, usually after a migration or a host change — the account can read but not insert.
- A value too big for its column — an absurdly long filename or path that won't fit where the database tries to store it.
How I'd run it down: first, check your error logs, because the real database error underneath that friendly message usually names the exact problem (“table is marked as crashed,” “disk full,” “unknown column”). That one look often ends the investigation. If you can't get to logs, check disk space (fast), then repair the plugin's tables (solves the crashed-table case), then make sure the plugin's database is fully upgraded to match its code version.
What I'd not do is keep re-uploading the image hoping it takes, or start reinstalling the plugin on instinct. The upload isn't the problem and a reinstall won't repair a crashed table — it might even skip the repair because the table technically still exists.
This one's solidly in “fixable in an afternoon” territory once you've read the actual error. If the logs are a mystery or the repair doesn't hold, the database is telling you something more specific and that's worth tracing — but start with the logs and a table repair. The file's fine. It's the check-in desk that needs fixing.
