While building my website I ran into a small problem that would of been trivial to solve had I thought to check the error logs.
Essentially, when I tried to add an image to a page (or post) I would get “HTTP Error” using the Flash uploader and “Error 413 – Request entity too large” using the browser based uploader. My first guess was that PHP was not configured properly for file uploads, so I checked that and unfortunately that was not the case. I found a post on the WordPress forums saying that sometimes WordPress is unable to request enough memory which causes uploads to fail. So, I tried some smaller images and they worked fine! Excellent I thought, somewhere there is a limit set that is preventing my larger images from working.
This website is running on Lighttpd, so I checked the server.max-request-size directive and it was fine (turns out it defaults to 2GB). Well, it seemed I was out of luck, and then I remembered the error log! Hurray! In the error log was a message that said:
2009-12-03 18:42:15: (connections.c.1097) denying upload as opening to temp-file for upload failed: /var/tmp/lighttpd-upload-B0R2Yi No such file or directory
As soon as I saw that I checked to see if /var/tmp existed and it did not, so I created it, tried the upload again, and BAM! We’re back in business.
The lesson to be learned here? Check your logs!