• Hi all. I need to use <input type=”file” /> tag (for adding unlimited files) instead of shortcode. If I try use it and view posted data before form submitting:

    $submission = WPCF7_Submission::get_instance();
    $data = $submission->get_posted_data();
    var_dump($data);

    I see only file submitted from shortcode. How can I submit file through standard HTML tag via this plugin?
    If I use input type “text” I can see value in posted data.

    https://wordpress.org/plugins/contact-form-7/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I can replicate what you’re talking about (and don’t have a solution via your particular method), but why can’t you just use multiple file upload shortcodes? I can get multiple attachments this way and it’s straight-forward. Sorry I can’t help you understand why it drops attachments that are html coded.

    Thread Starter web-maker

    (@web-maker)

    Multiple file upload shortcodes is limited solution. It needs two or more shortcodes. So, I don’t need a limited numbers of attachments, I need unlimited.

    The problem (not really a problem, though) is that CF7 utilizes tag names for the uploaded files and bases it off of the shortcode. So, even if you get it to select multiple files (which can be done simply), you’re not going to get them uploaded and attached to the email correctly without serious (re)coding on the backend of CF7.

    If we look at the fact that there is a single tag used in the attacment section for one shortcode, there’s no way for that one tag to reference multiple file-paths (at least not in its current state). The best thing you can hope for is to rewrite the file attachment coding or find something that replaces it altogether. But, whatever it is, it’s going to have to be specific to CF7 if you want to continue using one shortcode and one tag.

    And, before we circle back to the fact that you want to do HTML and not the shortcode… the shortcode turns into HTML and the inability to select multiple files for download is dependent on the (lack of) a “multiple” signifier in the input element. I’m thinking that’s why you really want HTML. But, I’ve added that so the shortcode includes it; I can then select multiple files; it then looks like they are uploaded; but then only one attaches. This is due to what was just mentioned above.

    So, as it stands now, you can only attach one per shortcode (as I referenced and as is mention on the CF7 site). However, you can use multiple shortcodes to allow for multiple files. Moreover, there’s a max attachment size on your email server, so it’s not a bad thing to not allow unlimited attachments anyway.

    Sorry there’s not a fix you’re wanting right now, but at least you (hopefully) have an explanation that suffices for the time being.

    Thread Starter web-maker

    (@web-maker)

    Thanks for the reply . I understand it and I recoding backend plugin for mounting multiple files without the addition of new tags in the File field in the Mail section. That’s why I need to use only HTML- tags , because the field will be added dynamically , I use JS for this . I thought maybe it was a ready solution . Sorry for the bad english .

    Thread Starter web-maker

    (@web-maker)

    Adding ‘multiple’ attribute to input tag is not solution. I need something like this http://www.quform.com/examples/file-uploads.
    It’s possible, but I need HTML tags in Form section to do this.

    You can add whatever you need to the HTML tag output by going into CF7 coding. Moreover, the only reason the HTML tags are not providing attachments with CF7 mail is because CF7 doesn’t have a way to pull/find the uploaded attachments that aren’t “touched” by its coding. So, regardless of your end method, you’re going to be modifying the CF7 coding or at least mimicking it if you want to use CF7. Have you been looking at the ‘file.php’ file for CF7 to see how it’s handling the upload shortcode and attachment?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Using html tag input type file instead of shortcode’ is closed to new replies.