Troubleshooting Unsuccessful File Uploads

If Craft is hanging or timing out while you’re uploading a large file, or if you get the error message “The uploaded file is empty”, you’re probably running into a limitation imposed by your server’s configuration.

The usual culprits are PHP’s memory_limit, post_max_size and upload_max_filesize config settings. Try increasing their values and see if that helps.

If you’re running into a memory_limit problem, you can verify that by opening up your craft/storage/runtime/logs folder and looking for a phperrors.log file that has entries similar to this:

[29-May-2014 17:22:29 UTC] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 16000001 bytes) in /some/path/to/site/craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 622

Changing your php.ini file’s memory_limit setting from something low like 32M to 128M or 256M will fix it.

If you make the changes directly in your php.ini file, you will need to restart your web server before the changes take effect.

There is an additional maxUploadFileSize config setting that is set to 16777216 (16MB) by default. This setting will limit the size of the file that a user is allowed to upload, but it still falls within PHP’s memory_limit constraints.

Another common culprit of unsuccessful file uploads is your server is running an old version of either GD or Imagick for its image processing library and you’re hitting a bug in the library. We recommend running the latest stable version of the library.

If you’re using GD, you also might be trying to upload an image in a format that it doesn’t support, like a 32-bit transparent PNG, which is why we also recommend using Imagick over GD, since it supports a much wider range of image formats.

Applies to Craft CMS 3.