Answers for "example formidable multiple image upload"

0

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);
});
Posted by: Guest on September-28-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language