Reputation: 853
I'm with a weird problem, it seems correct to me, well.. I'll try to explain :
my function uploader:
var body = '<html>'+
'<head>'+
'<meta http-equiv="Content-Type" '+
'content="text/html; charset=UTF-8" />'+
'</head>'+
'<body>'+
'<form action="/upload" enctype="multipart/form-data" '+
'method="post">'+
'<input type="text" name="text" multiple="multiple">'+
'<input type="submit" value="Submit" />'+
'</form>'+
'</body>'+
'</html>';
response.writeHead(200, {"Content-Type": "text/html"});
response.write(body);
response.end();
and my upload handler :
function upload(response, request) {
console.log("Request handler 'upload' was called.");
var form = new formidable.IncomingForm(),
fields = {};
console.log("about to parse");
response.writeHead(200, {"Content-Type": "text/html"});
response.write("You've sent the text: "+
querystring.parse(request).text);
response.end();
}
I know it's an Ultra novice question but, what is going on ? Can any of you guess?
Result when uploaded any text is : undefined
Funny thing the Post is being catch, because before parse it is an object..
Upvotes: 1
Views: 725
Reputation: 24617
In the code, the method is POST. Here are the issues:
querystring
is not defined for a POST requestmultipart/form-data
is not necessarymultiple
is not a necessary attribute for input type="text"
Upvotes: 1