• Resolved crackdavid

    (@crackdavid)


    Hi there,
    I am currently developing a form where you can upload a document that should be sent to an api via JSON.

    My JSON looks like this:
    {
    “formData”: {
    “file”: “[your-file]”,
    }
    }

    Unfortunately, formData.file only contains the file name:

    {
    “formData”: {
    “file”: “testfile.txt”,
    }
    }

    What is the best practice to send files to an API?

    Cheers,
    Chris

Viewing 1 replies (of 1 total)
  • Plugin Author Qube One ltd

    (@querysolutions)

    It is not supported at the moment
    But you can user the available filters to handle files

    $record = apply_filters( 'cf7api_create_record', $record , $submited_data , $qs_cf7_data_map , $type , $template );

    something like this

    add_filter('cf7api_create_record' , 'my_send_file' , 10 , 5 );
    
    function my_send_file( $record , $submited_data , $qs_cf7_data_map , $type , $template ){
        //add the file data from ths submitted data to the $record
        
        //dont forget to return the update record
        return $record;
    }
    • This reply was modified 6 years, 7 months ago by Qube One ltd.
Viewing 1 replies (of 1 total)
  • The topic ‘How to handle files?’ is closed to new replies.