Я хочу создать красный поток узла, который получает локальный файл, выбранный пользователем, используя локальную форму путем доступа к http://localhost:1880/uploadFile
, а затем я хочу вызвать конечную точку загрузки Spring http://localhost:8080/uploadFile
, которая принимает параметр userFile
, который должен быть file
объектом, загруженным с использованием HTML-элемента управления.
Запрос почтальона выглядит следующим образом:
POST /uploadFile HTTP/1.1
Host: localhost:8080
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: 7ce4af6f-e990-414d-b7ee-da87b2459f16
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="userFile"; filename="file100.json"
Content-Type:
------WebKitFormBoundary7MA4YWxkTrZu0gW
Я создал рабочий процесс, но он не работает. Multipart
объект попал в контроллер: null
.
Проект узла red:
[{"id":"e0dd6ce3.888e4","type":"debug","z":"8fccbdb9.9ebab","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"req.files","x":450,"y":880,"wires":[]},{"id":"bdd07a9d.cc1748","type":"httpInMultipart","z":"8fccbdb9.9ebab","name":"","url":"/upload_post","method":"post","fields":"[{\"name\":\"userFile\"}]","swaggerDoc":"","x":110,"y":880,"wires":[["e0dd6ce3.888e4","f3d822c.a0300e"]]},{"id":"a3997970.3c89c8","type":"http request","z":"8fccbdb9.9ebab","name":"","method":"POST","ret":"obj","url":"http://localhost:8080/uploadFile","tls":"","x":630,"y":760,"wires":[["34e2955f.2d931a","768507e9.001da8"]]},{"id":"34e2955f.2d931a","type":"debug","z":"8fccbdb9.9ebab","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":830,"y":680,"wires":[]},{"id":"768507e9.001da8","type":"http response","z":"8fccbdb9.9ebab","name":"","statusCode":"","headers":{},"x":850,"y":760,"wires":[]},{"id":"f3d822c.a0300e","type":"function","z":"8fccbdb9.9ebab","name":"Headers","func":"msg.headers = {};\n\nmsg.headers['Content-Type']= 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW';\n//msg.headers['boundary']='----WebKitFormBoundary7MA4YWxkTrZu0gW';\nmsg.headers['Content-Disposition']='form-data; name=\"patternFile\"; filename=\"file100.json\"';\n// msg.headers['name']='patternFile';\n// msg.headers['filename']='file100.json';\n\n// return msg;\nreturn [ msg, msg.payload];","outputs":1,"noerr":0,"x":400,"y":760,"wires":[["a3997970.3c89c8"]]},{"id":"cb96168b.2e1ba8","type":"http in","z":"8fccbdb9.9ebab","name":"","url":"/upload_post1","method":"post","upload":true,"swaggerDoc":"","x":110,"y":760,"wires":[["6e5ad2f2.b0f62c","f3d822c.a0300e"]]},{"id":"6e5ad2f2.b0f62c","type":"debug","z":"8fccbdb9.9ebab","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"req.files","x":410,"y":640,"wires":[]}]