Multiple files upload broken
-
Hello,
I hope that some of the wpcf7 developers will read it but nevertheless I have found a bug related to sending multiple attachments. It seems present from version 5.4.
My use case was to generate 2 pdf files before the submission and attach those files to the e-mail. I created them and built a string concatenated from 2 file names and separated by \n that I put to the $wpcf7[‘mail’][‘attachments’]. No luck. I tried what I could, I read all threads on StackOverflow and wp forums but I was still not able to send more than one attachment, even when I was convinced that my code is OK.
I started debugging the mail.php and after some fiddling, I discovered that the method attachments( $template = null ) does not correctly split the attachment file names from the $template.
Not working:
foreach ( explode( “\n”, $template ) as $line ) {
…Working:
$atts_arr = explode(‘\n’, $template );
foreach ( $atts_arr as $line ) {
$line = trim( $line );
…
The topic ‘Multiple files upload broken’ is closed to new replies.