Cannot browse uploaded files in Wordpress
Sunday, November 5th, 2006 at 10:26 am
[Update: I've since discovered you can actually do this on the Windows version when you set up your instance. It's just a checkbox that needs to be set.]
I recently had a problem with not being able to browse uploaded files in Wordpress after uploading. In Wordpress when writing a page or a post you have the ability to upload files to the webserver and include them (as full-size originals or thumbnails) to the post.
I was able to upload the files without issue and Wordpress created the thumbnail as well. However, I never received the “Browse” tab that would allow me to add the images to the editor (an subsequently to my post).
After some Googling I discovered the issue. I’m running Wordpress on a LAMP system (Linux, Apache, MySQL, & PHP). However, my database is actually running on a separate server than the webserver, and it’s a Windows box at that. I’m running the Windows version of MySQL 5.
Apparently MySQL 5 introduced a “strict” mode that requires all columns be explicitly named during an insert or update. DB2, Informix, and SQL Server do not require this and previous versions of MySQL, to my knowledge, didn’t either. According to my friend Tim, who’s running MySQL on Fedora Core 5 Linux, he does not have this problem. Apparently this only applies to the Windows version of MySQL 5. I guess it could also be that the Fedora people turn strict mode off by default.
The solution to this problems was to turn off strict mode. This was done like so:
- Browse to “C:\Program Files\MySQL\MySQL Server 5.0″. (This is assuming a default installation of MySQL. If you put it somewhere else, go there.)
- Make a copy of “my.ini”.
- Open “my.ini” with your favorite text editor (such as gVim).
- Go to line 87. Comment out the line with a pound (#) sign. It’ll look like this when you’re finished:
Code:
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
- Save the file.
- Open the MySQL administrator tool (or go to the services console in Windows) and restart the MySQL service.
You won’t see the “Browse” or “Browse All” tabs appear in Wordpress immediately. Once you upload an image, however, they’ll appear. You’ll then click on the thumbnail for options. Check the Wordpress documentation for more information on how to use this feature (that’s beyond the scope of this article).
(Disclaimer: It’s always a good idea to do this stuff in a development environment before rolling it to your production server. Also, I’m not responsible if you blow your stuff up; this is only advice.)
FACT: The phrase 'balls to the wall' was originally conceived to describe Chuck Norris entering any building smaller than an aircraft hangar.

Leave a Reply