• Hi

    I want to send data submitted in contact form 7 to third party API using curl. All data except files are passed.
    Multiple file upload is used in cf7 and it named as filename. The API accepts 4 files separately as filename1, filename2 etc.
    Am using curl to send data to API in wpcf7_before_send_mail hook.

    When using following code I got realpath as null :
    $applicationData[‘filename’.$i.’]’] = curl_file_create(
    realpath($file),
    mime_content_type($file),
    basename($file)
    );

    When using following code I got tmp_name as null.Here am using single file upload :
    $path = $_FILES[‘filename’][‘tmp_name’];
    $curlFile = new CURLFile($path);
    $curlFile->setPostFilename($_FILES[‘filename’][‘name’]);
    $applicationData[‘filename1’] = $curlFile;

    How can I pass files to API ?
    How would I solve this?
    Thank you in advance!

    • This topic was modified 4 years, 5 months ago by Ashly Sunny.
  • The topic ‘Send files in contact form7 to API using curl’ is closed to new replies.