Not receiving file upload filename in webhook.

  • triplesliftservices
    Asked on January 22, 2018 at 6:55 AM

    Hi I am currently using a webhook to save form data into a mysql database and am able to receive all data except the filename of the file uploads. For most fields I am using the following format which is working well:

    $fieldname = $mysqli->real_escape_string($obj['fieldname']);

    For json arrays such as radio buttons I am using the following:

    $fieldname = $mysqli->real_escape_string((json_decode($obj['fieldname'], true)[0]));

    But for the file upload field I am not getting any data through.


    Thanks,

    Anthony




  • Richie JotForm Support
    Replied on January 22, 2018 at 10:50 AM

    I have checked the upload file and it has no field name but the text. Have your tried using {upload} as the object?

    $fieldname = $mysqli->real_escape_string($obj['upload']);

    Let us know how it goes.


  • triplesliftservices
    Replied on January 24, 2018 at 6:33 AM

    Hi Ritchie,

    Turns out I just need to drop the field prefixes so instead of:

    $attachfiles = $mysqli->real_escape_string($obj['q193_attachFiles193'][0]);

    I needed to put:

    $attachfiles = $mysqli->real_escape_string($obj['attachFiles193'][0]);

    Then creating:

    $attachfilesb = $mysqli->real_escape_string($obj['attachFiles193'][1]);

    $attachfilesc = $mysqli->real_escape_string($obj['attachFiles193'][2]);

    $attachfilesd = $mysqli->real_escape_string($obj['attachFiles193'][3]);

    To pull out the remaining filenames in the array (Form is capped at 4 files per upload field but has 9 upload fields!!)

    Interestingly the above method includes the full file url not just the filename so no need to contstruct in php.

    Thanks,

    Anthony



  • Richie JotForm Support
    Replied on January 24, 2018 at 8:23 AM

    Thank you for your added information/workaround on webhooks and the upload files proper syntax/filename  to be used.

    Usually the Form Fields text is used to get the proper label/text for the filenames for the webhook.

    We really appreciate your work around on the issue.

    Please let us know if you have further questions.