example formidable multiple image upload

Example: example formidable multiple image upload

app.post('/upload',function(req,res){
    var form = new formidable.IncomingForm(),
    files = [],
    fields = [];
    form.on('field', function(field, value) {
        console.log("field");
        fields.push([field, value]);
    });
    form.on('file', function(field, file) {
        console.log(file.name);
        console.log(JSON.stringify(field));
        files.push([field, file]);
    });
    form.on('end', function() {
         console.log('done');
    });
    form.parse(req);
});

Tags:

Misc Example