Multipart/form-data processing via HttpTrigger using NodeJS Azure functions

In this guide , I will show you how to process multipart form data via HttpTrigger in a NodeJS Azure Function.

Now lets create the function in the portal.

Once the function is created , go the plateform features and click (Advanced Tools) Kudu

Advanced Tools Kudu

Once in Kudu , Click Debug Console and Run CMD

Lanch CMD

Goto the Azurefunction folder in this case HttpTrigger1, create a package.json file by either running npm init and then copying the code below.

and then copying the code below to seperate files (function.js, index.js and package.json)

Run npm install and you are ready to test your function

Go to the Azure function and copy the URL

Click Get function URL

now you are ready to test it , download and open PostMan and paste the URL

Choose form-data and add file type , attach the test file

now you will receive the size of the file , file name and content type.

6 thoughts on “Multipart/form-data processing via HttpTrigger using NodeJS Azure functions”

    • Hi Dan, In my example I needed to see how much the azure function have received in terms of file length, you can adapt it to your needs though

  1. hi there, have you experienced issues when using this with a form that submits more than one field (e.g. “name”, “file”)? i am getting “Cannot read property ‘split’ of undefined”. the same code with a form that only has the file field works fine.
    any pointers would be very much appreciated.

Leave a Comment