example formidable multiple image upload

Solutions on MaxInterview for example formidable multiple image upload by the best coders in the world

showing results for - "example formidable multiple image upload"
Lara
14 Aug 2019
1app.post('/upload',function(req,res){
2    var form = new formidable.IncomingForm(),
3    files = [],
4    fields = [];
5    form.on('field', function(field, value) {
6        console.log("field");
7        fields.push([field, value]);
8    });
9    form.on('file', function(field, file) {
10        console.log(file.name);
11        console.log(JSON.stringify(field));
12        files.push([field, file]);
13    });
14    form.on('end', function() {
15         console.log('done');
16    });
17    form.parse(req);
18});