Craft CMS image upload fails

Posted on 29th Oct 2015

Yep, I'm sure all Craft developers have been there at some point. You go to upload an image, you get the pretty progress bar, it gets to the end, and then nothing.

There can be many reasons why this might happen. Here's my checklist:

  1. Is the upload directory writable?
    Fix: Check your directories permissions. It should be set to 775 or 777 (if you live life on the edge)
  2. Are the asset paths set correctly? You can find these in admin/settings/assets
    Fix: Check you have the correct absolute or relative paths and URLs set. If you're using multiple-environment configurations and are using variables like {basePath} and {baseUrl}, check these are correct in your craft/config/general.php file.
  3. Is it a PHP memory_limit problem? If it is, chances are there's an error logged in craft/storage/runtime/logs
    Fix: Get your hosting provider to increase PHP's memory_limit to 64MB, 128MB or 256MB (if you're feeling particularly adventurous)
  4. Is the upload script timing out? Again, if this is the case there could be an error indicating so in craft/storage/runtime/logs
    Fix: Get your hosting provider to increase PHP's max_execution_time
  5. If you've got this far and are still having problems you may need to use the following wizardry to get things working. I've had this problem when trying to upload JPGs (where every other file would upload fine).
    Fix: Get your hosting provider to update the PHP configuration (typically the php.ini file) by adding mbstring.func_overload = 0
    Thanks go out to 'Oliver' over on this Stack Exchange thread for that fix!