get post data from file upload

Posted on
  • Is it possible to get the data of a post request from within the http.createServer callback?

    http.createServer(function(req, res) {
        if (req.method == "GET") {
            // do get stuff
        } else if (req.method == "POST") {
            // save post data to sd-card
  • Not yet - I just created an issue for this though:­ues/226

    You can hack around it by looking at the actual data received though:

    function pageHandler(req, res) {
      res.writeHead(200, {'Content-Type': 'text/html'});
      res.write('<html><body><form method="post"><textarea name="foo"></textarea><input type="submit"></form></body></html>');

    However it is an internal variable so it may change in the future.

  • Thank you. Thats exactly what i was looking for.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

get post data from file upload

Posted by Avatar for loopMasta @loopMasta