Last active
August 29, 2015 14:06
-
-
Save alanhoff/6630b02e4177f098e225 to your computer and use it in GitHub Desktop.
Recebendo uploads com Hapi.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.route({ | |
method: 'POST', | |
path: '/submit', | |
config: { | |
payload: { | |
output: 'file', // Vamos receber arquivos | |
parse: true, // Fazer o parse dos campos | |
allow: 'multipart/form-data' // Só podemos receber forms | |
maxBytes: 10000000 // Limite de 10MB, | |
uploads: __dirname + '/../uploads' // diretório onde guardar os arquivos | |
}, | |
handler: function(request, reply) { | |
var data = request.payload; | |
// teus dados devem estar aqui dentro agora | |
console.log(data); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment