phpthumb wordpress 404 Not Found

When uploading an image to a custom field in WordPress, I got a “success” message, followed by an error like this,

phpThumb()
Error opening "http://example.com/wp-content/files_mf/long_file_name.jpg"

404 Not Found

I then tried to download the file from the server using wget:
>wget http://example.com/wp-content/files_mf/long_file_name.jpg
and saw this:

Resolving example.com... 127.0.0.1
Connecting to example.com|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
14:43:09 ERROR 404: Not Found.

When I looked at the /etc/hosts file I saw something like this:
127.0.0.1 example.com
I changed it to

127.0.0.01 localhost
[real ip address] example.com

Now the URL can be found from the webserver. Problem solved.