Skip to content

Latest commit

 

History

History
19 lines (19 loc) · 660 Bytes

EN19CS301146_IshanSoni.md

File metadata and controls

19 lines (19 loc) · 660 Bytes

node.js code for uploading a file

var http = require('http'); var formidable = require('formidable'); http.createServer(function (req, res) { if (req.url == '/fileupload') { var form = new formidable.IncomingForm(); form.parse(req, function (err, fields, files) { res.write('File uploaded'); res.end(); }); } else { res.writeHead(200, {'Content-Type': 'text/html'}); res.write('

'); res.write('
'); res.write(''); res.write(''); return res.end(); } }).listen(8080);