jeanpaul62
jeanpaul62

Reputation: 10551

Upload file to Zapier Webhook

Is uploading files to a zapier webhook via POST allowed?

I didn't manage to get it working. In my form, I have some text inputs (name, email etc), and one <input type="file" name="cv" />. Here's my AJAX code:

$('#__formID__').submit(function(e) {

  var data = new FormData($(this)[0]);
  console.log(data.get('cv'));

  $.ajax({
    url: 'https://hooks.zapier.com/hooks/catch/someid/someid/',
    type: 'POST',

    // Form data
    data: data,
    // Tell jQuery not to process data or worry about content-type
    // You *must* include these options!
    cache: false,
    contentType: false,
    processData: false,
  });
});

The file (cv) does get sent, I see the correct console.log above, and I see this in the Request Payload (in Chrome console):

------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="name"

John Doe
------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="university"

BLABLABLA
------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="email"

[email protected]
------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="skype"

johndoe
------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="skills"

dsaf
------WebKitFormBoundary4sbU6QlU3xl7ox2f
Content-Disposition: form-data; name="cv"; filename="cv-fr.pdf"
Content-Type: application/pdf


------WebKitFormBoundary4sbU6QlU3xl7ox2f--

But on the Zapier side, I receive every attribute except the cv one:

name:   John Doe
university: BLABLABLA
skills: dsaf
skype:  johndoe
email:  [email protected]

Upvotes: 3

Views: 1253

Answers (1)

DFATPUNK
DFATPUNK

Reputation: 123

It seems that Zapier accepts raw data for the request: "Place raw data for the request here. Could be JSON, XML, etc."

To my understanding, PDF is not considered as raw data. Your case tends to verify this hypothesis as only your strings pass.

Upvotes: 2

Related Questions