Checking if input as:file is empty


In a template, I would like to be able to check if a input for an attachement/file is empty or not.
i.e., if I have an input tag

{% input as:file%}

I want to check if a file has been provided or not, in order to be able to adjust the content of the template accordingly.
Something like

{% if == emtpy %}No file has been uploaded {% endif %}

does not work: with as:file-inputs, is always empty (although this does work for other input-types as:currency, as:text,…)

Is there another way to check an as:file-input for emptyness, or is such a thing not possible at the moment?

Thanks in advance!

Hello @robin.bailleul,

Could you please try adding .document in your if-statement:

For example:

{% input as:file %}

{% if == emtpy %}No file has been uploaded {% endif %}

Please let us know if the problem is not solved.

Kind regards,


1 Like

Hi @Mathias,

Adding .document did indeed allow me to check whether a as:file input was provided or not.
However, testing for empty always returns false, while testing for blank yields the expected behaviour:

{% input as document
{% if == blank %} No file has been provided
{% else %} A file has been provided {% endif %}

My problem is hereby solved :slight_smile:

Kind regards,