How to upload a file by using InvokeHTTP (multipart/form-data)?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to upload a file by using InvokeHTTP (multipart/form-data)?

Nattaphol Lertpaibulpanya


I try to use InvokeHTTP processor to upload a file and got some error. I had a HTTP POST message that I tested by using Postman and everything ok. 

I try to implement in NIFI but I cannot change the Content-Type by using UpdateAttribute processor as I searched in the internet. Nifi still used the default value as Picture1 and I guess it produced the error in the Picture2 due to it could not find the username field that I sent in the flowfile content as a multipart/form-data.

What I did wrong?

Nattaphol L.

POST /xxx/dropfile/ HTTP/1.1
Host: xxx
Cache-Control: no-cache
Postman-Token: 21171a40-f903-aea3-3fda-49092758f5ce
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

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

Content-Disposition: form-data; name="file"; filename="xxx.json"
Content-Type: application/json





Picture3: content in the flow file

Sent from Outlook