Can anyone tell me How to upload files Using nodejs and HAPI?
I am getting binary data inside the handler.
Here is my html code:
function sen
For new readers, hapi already using multiparty uses pez to handle multipart post requests. From hapi documentation;
If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams. File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties.
Example;
server.route({
method: 'POST',
path: '/create',
config: {
payload:{
maxBytes: 209715200,
output:'stream',
parse: true
},
handler: function (request, reply) {
request.payload["htmlInputName"].pipe(fs.createWriteStream("test"));
}
});