We are getting a "Failed to write file" error popup when attempting to upload an image in civimail using KCfinder. This worked until about a month ago, and I don't what has changed. The files in the ~/wordpress/wp-content/plugins/files/civicrm/persist/contribute/images folder are visible in KCfinder, and can be inserted into the email. When I manually copy new image files into that directory, they appear in KCfinder and can be used. The permissions on the directory are 775, the images have 644, and the file ownership is correct. So I don't see anything wrong with any of that. Any ideas? This is on PHP 7.0.28, WP 4.9.5, Civicrm 4.7.30.
Found the answer so I will post it here to help others. The server /tmp space filled up due to a rogue imagemagick process, so Civimail could not upload new images. This is a known issue with imagemagick - see for example this post. Deleting /tmp/magick-* files solved the problem.