Replies: 0
I’m using this code;
add_action( 'wpcf7_before_send_mail', 'wpcf7_file_download' );
function wpcf7_file_download($submission)
{
//check if it is the right form
if ($submission->id()==11869)
{
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('pdf', "/wordpress/wp-content/uploads/MandW-Case-Study.pdf");
}
}
which returns the error
“JSON.parse: unexpected character at line 1 column 1 of the JSON data”
if I take out everything from the function
function wpcf7_file_download($submission)
{
//check if it is the right form
if ($submission->id()==11869)
{
}
}
I get the same error. What’s going wrong?
BTW I will using a dynamic reference to the file once I have this working so I can’t use your File Attachments option.
I have also, after reading a similar thread, put [pdf] into the File Attachments field, is this correct?