0

Developing a new site with Drupal 8, I was attempting to add an image to a custom block. In the editor I clicked the image icon and got a dialog to upload an image. After specifying a file (making sure it was within the upload file size), I got a strange error "Image field is required."

I took the error message literally, and created a new custom block type, adding a field of type "image" to the block. So now in the form, I have a Body and an Image field. If I try to upload using the "image" field below the body, I get the same error "Image field is required."

Error message when attempting to insert an image

I tried again using the Content / Media tab, to add an image file, and get the same error:

Error on media upload

(I also notice that there's a "Caption" checkbox but no field to enter a caption. I'm assuming I'll have a text field once the image is uploaded.)

Drupal 8.8, all current.

2
  • Did you check the error log at /admin/reports/dblog? Perhaps your system does not have write permission or proper group/owner to put uploaded image in the /sites/default/files folder.
    – No Sssweat
    Mar 30, 2020 at 0:46
  • Yes, thank you, there are no error messages in /admin/reports/dblog related to this, and the files directory is writable.
    – Mojo
    Mar 30, 2020 at 1:05

1 Answer 1

0

The error message appears to be a red herring. Even though I thought I had fixed the nginx upload file size limit, I found that it was still at the default of 1mb. I fixed the upload limits to be sufficiently large in both nginx and php, and I was able to successfully add media content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.