File Upload Features

#1

I'm trying to build an application which will allow a user to upload a text file through a basic web form and be able to read the text file to take its contents as a string. Is this possible? I currently have a system set up which sends the text file to a particular URL and gets the file info from this URL, but I'm unsure how to access the text data itself.

My debug node outputs this which is correct, but like I said I'm not sure how to access that actual file data itself. The node map looks like this. The function node is just a test node that sets the payload to OK and returns it at the moment.

Does anybody know how to go about doing this? Thanks

0 Likes

#2

Hi @nhar

in the Debug node output the contents of file can be seen under the 'buffer' property.

So in your flow, you can access the contents as msg.req.files[0].buffer.

You can use a Function node to convert the buffer to a String using:

msg.payload = msg.req.files[0].buffer.toString();
return msg;
0 Likes

#3

that was it, thank you so much!

0 Likes