Forminator upload field

Right now we have a problem with forms, our end users are supposed to send us their CV. The current file upload is just uploading file to wp upload directory, there is a violation with GDPR5.

We want to directly attach files to emails, is it possible?

Also, I want to make my own custom file upload so instead of storing that field it just attaches and sends an email. Is there any guide or doc for all registered hook, so I can hook maybe into the plugin functionality and change the behavior in a specific situation, for example, prevent it from uploading a file.

  • Nithin
    • Support Wizard

    Hi Mehran ,

    We have already brought this ticket into our SLS(Second Level Support) teams attention to see whether there are any hooks or quick workarounds that could be suggested regarding this.

    Will keep you posted once I get further feedback. have a nice day ahead.


  • Panos
    • SLS

    Hi Mehran !

    I’m not a GDPR expert, but I doubt that attaching CVs on emails is GDPR complaint method. I would recommend to use the GDPR field in Forminator to inform members about how you deal with the data they send in.

    As for the technical view of your request, managing files on the fly, requires to check file types and sizes which can get complex. So this is out of support scope, but you can hire a dev from our partners page :

    Simplest way is to attach the uploaded file and instantly delete the file. If you would like to try something like that, you can try out the snippet from here :

    In order to test that, once you download, unzip it and upload the forminator-attach-upload-to-email.php file to your wp-content/mu-plugins folder (you can simply create that folder if it doesn’t exist ). Then try submitting your form and check the email received by the admin should have the file(s) attached and the files should be deleted from the uploads folder.

    Kind regards!

  • Mehran
    • WPMU DEV Initiate

    This is perfect. Only 3 small issues:
    1. When we active this plugin it is going to send data to email + attachment but it’s going to skip submission data. Is there a chance to also get text data as a submission? Or Gspreedsheet if it was integrated. (it doesn’t matter if the attachment is missing)
    2. When we active plugin it’s going to affect all other forms. For example, we have a contact form and we don’t receive any submission for it.
    3. As long as I see in the given plugin we can have only 2 fields? (on line 21). Is there a chance to make it dynamic so we can support multiple file input.
    4. Can we have a file attachment field type to only support attachments?

    Thank you very much. You guys rock!

  • Panos
    • SLS

    Hi Mehran !

    Thanks for your kind words!

    1. You’re right! I didn’t notice that. I have updated the snippet fixing that. Currently it removes only the upload fields

    2. I have now added another line that you can set which form(s) you want this check to take place. You can set your forms on line 20:
    public $form_ids = array( 4412, 4682, 6153 );

    3. I didn’t explain that correctly the first time. You can add as many field ids in that array, for exmple:
    public $upload_fields = array( 'upload-1', 'upload-2', 'upload-8' );

    4. You mean you want only specific field types, eg only files with doc,csv and xml extensions? Do you want the form to stop submit (and throw error message) if those file types are incorrect or do you just want to let hem be stored and not attach them?

    In order to update your snippet, you can download it again from the same link :

    Kind regards!

  • Mehran
    • WPMU DEV Initiate

    Thanks for the response. Look here is what I need to do:
    I have 2 forms:
    Apply Form & Contact Form

    Apply form contains a file input, which I need to send it as an attachment. I also need a record of form data in the submission section in wp-admin panel (without attachment(s)).

    Contact Form should use the forminator default functionality. If there is a file input it can upload it to wp uploads.

    It would be great if we had a unique file upload field. something like attachment so when I use that type it is going to send the data as an attachment.

    If I don’t use it and instead use a normal file input it use a default functionality.

  • Panos
    • SLS

    Oh I see now what you mean. Thanks for the clarification!

    I have passed that request to the developers however I don’t know if that will be added. I’ll let you know once I have some news.

    For now, you can specify the upload filed that you want to be added as an attachment(s) in this line:
    public $upload_fields = array( 'upload-1', 'upload-2', 'upload-8' );

    You can also include only the Apply form’s form id in this line:
    public $form_ids = array( 4412, 4682, 6153 );

    Did you try give that a try?

  • Mehran
    • WPMU DEV Initiate

    This workaround works fine but the problem is we have multiple servers and when we import the forms on each one the form id is different and it’s not a good idea to hard code from IDs into code.

    Can you please tell what exactly gonna be added to the future release? Do you have any specific release date?

    Which features are going to be added on the next release:
    – Ability to make a custom form field
    – Add email attachment field or ability to set an option as attachment
    – Set custom field name

    It would be great if you clear things a bit. Thank you.

  • Panos
    • SLS

    I was talking about the second feature you mention. Ability to add a file as an email attachment. Unfortunately I don’t have any ETA on when this will be included.

    I understand the frustration of having to add the form ids on each site. For this I have modified the snippet adding custom options in the Upload fields Edit Field popup (the one that appears once clicking on the field ). Specifically it creates a new tab there, labeled as Advanced. In that tab there should be 2 options.

    First one labeled as Attach to email dictates that the uploaded file should be added as an attachment to the email (the one sent to admin)

    Second one, labeled as Delete file after upload specifies if that file should be deleted after email is sent.

    You can download it again from the same place:
    and give it a try.

    Hope this is something that you find a bit more useful :slight_smile:

    Kind regards!

  • Mehran
    • WPMU DEV Initiate

    You are perfect guys. Finally, we are getting somewhere. This is 99% what we need. Is there a chance when an upload field should be attached & deleted, Instead of passing like (which is broked cause we already removed that link from the wp uploads directory) just write something like “file is attached”?

    This when we see the form submission data we don’t face a broken link. We know that it was an attachment and it is already in the email.

    Anyway, thank you. I highly recommend to add this feature to the current code base and let everyone use this delete & attachment functionality. Super handy.

    Thanks again.

  • Panos
    • SLS

    Glad this was helpful!

    I don’t see any easy way to add a custom content there. The easiest thing to do is to simply remove that entry, leaving it blank instead of showing a broken link. If you are interested in something like that, you can simply add this line:
    unset( $data[$key] );
    right under :
    $this->attachments_to_delete[] = $file_path;
    should be line 89

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.