I have created a form and I am trying to get an image to upload. I have the following set:

      'file', // field type
      'image_file', // field name
      'Upload Image', // field label      
      TRUE // is required

However, when I submit the file it does not upload anywhere. Any ideas on what I am doing wrong?


1 Answer 1


You missed a param to that function. The 4th param is attributes, which you can pass as an empty array, and the 5th param is required, which you can pass TRUE.

  • I added the array and it now gives me the following error when submitting: "Please correct the following errors in the form fields below: Upload Image is a required field."
    – Sleewok
    Commented Jan 19, 2017 at 14:56
  • ALSO, where can I find documentation on the attributes? I would like to specify the filename when uploading...
    – Sleewok
    Commented Jan 19, 2017 at 14:57

Your Answer

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

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