Archives Sept. 8, 2010

Django PIL Error - The file you uploaded was either not an image or a corrupted image.

When uploading an image with Django admin, or a Django based CMS, you receive the following error:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

The solution, on CentOS, Red Hat and Fedora, is to ensure that Python Image Library (PIL) is installed and compiled after libjpeg-devel is installed:

sudo yum install libjpeg-devel
workon mysite
pip uninstall PIL
pip install PIL

This will compile PIL with the correct JPG support and fix the error above.

— Andrew


Site theme originally by styleshout.com