• Hello Guys,

    I’m trying to attach a file from a hidden field on the form.

    Currently i have this three ways to try to get the file. This are on the CF7 ‘Form’ (body) tab:

    [checkbox* checkbox-167 id:seleccion use_label_element exclusive "file1" "file2"]
    
    [dynamichidden documento id:doc "not found"]
    
    <input type="hidden" id="selected-file" name="selected-file">

    Ok, now with some JS i add the values for the hidden input and also for the Chekbox. I try a lot of changes on the JS but the main idea is…

    jQuery(document).ready(function( $ ){
    	$('#seleccion .first input[name="checkbox-167"]').val('uploads/2022/10/file1.pdf');
    	$('#seleccion .last input[name="checkbox-167"]').val('uploads/2022/10/file2.pdf');
    	var eldoc = $("input[type=checkbox][name=checkbox-167]:checked").val();	
    	
      $('#seleccion input[type="checkbox"]').click(function(){
        var value = $(this).val();
        $('#doc').val(value);
        $('#selected-file').val(value);
        
      });
    });

    I try with different paths /uploads/, uploads/, /wp-content/uploads/ https://thewebsite.com/wp-content/uploads/ but nothing works.

    On the CF7 ‘Mail’ tab i try to add the file and… On the body of the email, i get the field as needed, but on the file attachements not works.

    [checkbox-167] return: uploads/2022/10/file1.pdf

    [documento] return: uploads/2022/10/file1.pdf

    [selected-file] return: uploads/2022/10/file1.pdf

    I try add all the fields on the “Fields Attachments” Box but nothing works, the files are not attached. I try add only one, two and all the document fields at the same time.

    The wordpress attachment files seems Works Ok because, if i “add” the file as plain text (uploads/2022/10/file1.pdf) When i send the email, the file is attached correctly but if i add some [documento] the file are not attached.

    I have all the latest plugin and wordpress.

    Regards.

    • This topic was modified 2 years, 4 months ago by Mimergt.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter Mimergt

    (@mimergt)

    Hello, I review the post but i don’t know how “attach” the file to the <input type=”file”> I try to use the [file your-file filetypes:pdf|txt limit:2mb] but i don’t know how add my file without upload.

    The file that i need attach on the e-mail are on the wordpress/uploads/ (the user don’t need upload anything).

    How can i add the email-tag [file] with a custom value/file (value added by js) not the file added by the user.

    Regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘file attachment not works with custom field’ is closed to new replies.