1

Well... the title almost said what i'm trying to do. The thing is that i cannot get the files no the backend code. if i do a console.log(req.files) it returns undefined and idk why.

Jquery code

$('#new-images-form').attr('action', __url + '/uploadItemImages');
$('#new-images-form').ajaxSubmit({
    success: function(data){
        console.log(data);
     },
    error: function(data){
        console.log(data);
    }
});

HTML code

<form action="#" id='new-images-form' method="post" enctype="multipart/form-data">
    <input type="file" id='new-images' name='new-images' ng-model='itemImages' class='absolute disp-none' multiple accept='image/*'>
</form>

Node.js code

app.post('/uploadItemImages', function(req,res){
    upload(req ,res , function(err){
        if(err) return res.send(err);
        res.send('Images successfully saved');
    });
});

0 Answers0