I have a webform, in which I have file upload.

However, when user chooses no file, he is still able to click upload and nothing happens. I would like to have there similar message like when he chooses file with extension which is not allowed. How can I achieve this?

  • You can use jquery for custom validations. when user will click that button popup one error message.
    – Suraj
    Aug 24, 2016 at 13:26

1 Answer 1


You could use the client side validaiton module install it then configure it for webforms , you could also use the module's hooks to customise error messages or create custom error handling functions client side validation

  • I have no clue, how to use that to achieve my goal. I tried to use hook_file_validate, but apparently, it doesn't go within that hook, when you don't attach file
    – rukya
    Aug 19, 2016 at 9:38
  • @rukya, Can u please mention the code which u have written to validate for file upload??
    – Suraj
    Aug 24, 2016 at 13:21

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.