1

I am trying to upload multiple image using jquery plugin jQuery File Upload.

I have got in post request like this, when I upload image:

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);
});

Even I could not get console message.

When I upload image, that request contain file like this:

files: { files: [ [Object] ] },

How to solve this?

1
  • form.on(field) and file and end functions are not working. Commented Jun 5, 2013 at 5:38

1 Answer 1

1

You don't need to work directly with formidable to do that. The BodyParser() from express does what you want (it uses formidable).

Just refere to the doc: req.files

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.