felixge/node-formidable — Issue #105: 500 Error: bad content-type header, no content-type
Author: ravi063
Created: 2011-11-06 13:58:19+00:00
State: open

Hi,
I just tried the given sample example to upload my file and it worked well. Later, i created a sample express application
using jade for my view. The jade file content is:

form(action='/upload', enctype='multipart/form-data')
input(type='file', name='upload')
input(type='submit')

Then in app.js file has code:

app.get('/upload', function(req, res) {
var formidable = require('formidable'),
http = require('http'),
fs = require('fs'),
sys = require('sys');
var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received upload:');
res.end(sys.inspect({fields: fields, files: files}));
});
});
I tried to upload a text file, this gave me error: 500 Error: bad content-type header, no content-
type.
I get error at line: form.parse(req, function(err, fields, files)
{...}.
plz help me to solve this error.