Best answer

Zapier CLI Upload File to API URL

  • 18 May 2020
  • 2 replies
  • 2651 views

Hi, 

I am trying to upload a file to API endpoint, I am using form-data append method explained here: https://platform.zapier.com/cli_tutorials/hydration. But the issue I am facing is our API only support multipart binary file and Zapier is sending response from `request(file)`.

So is there any option to convert Hydrated File URL to get file path, so that I can send binary data to the API?

Thanks

icon

Best answer by karan-fytech 22 May 2020, 08:04

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +12

Hi @karan-fytech! It looks like you’ve also reached out to the Support Team about this one. They’re in the best position to help in this case, so please could you continue the discussion with them via email? Thanks! 

Hi all, 

If someone landed here for the solution: After digging a lot I have found the solution, the issue is caused by using latest versions of “form-data” and “request” repositories. So if you are having same issue just downgrade the above mentioned repositories to exactly: 

"form-data": "2.1.4",
"request": "2.81.0" // Most important

And do specify a filename parameter while appending file to formData like:

formData.append("file", request(bundle.inputData.file), {
filename: bundle.inputData.name // This filename is important, if removed it will throw error
})

Regards,
Karan Singh Sisodia