Send default file if no file selected

In the support forums the question was asked if it was possible to attach a default image to an email if a form user didn’t upload a file.

The form below shows one approach you can use to achieve this.

Note: for security and privacy reasons, uploaded files are not actually saved on this server. So your uploaded image will not appear in the e-mail preview. If you use the code on your own website though, it should work fine.


    file* f1

    this file will be sent:

    Form Code

    [radio select-file use_label_element "default file" "uploaded file"]
    [group f1-group]
      file* f1 [file* f1]
    [group default-group]
      this file will be sent: <img width="50" src="">

    Email Body

    Here's your file:
    <img src="[f1-group][f1][/f1-group][default-group][/default-group]">

    Conditional Fields (Text)

    show [f1-group] if [select-file] equals "uploaded file"
    show [default-group] if [select-file] equals "default file"



    Edit this form in the form tester