ParseFile: cannot call then in save function

I try to save an image using ParseFile in js sdk and I retrieve this error:

TypeError: Cannot call method 'then' of undefined
    at Object.Parse.File.save (/PATH_TO_PROJECT/node_modules/parse/build/parse-latest.js:4281:43)
    at null.<anonymous> (/PATH_TO_PROJECT/node_modules/parse/build/parse-latest.js:5984:21)

here is my ejs code:

<form class="basic-grey" action="/confirm" method="post" enctype="multipart/form-data">
   <input id="picture" name="picture" type="file" class="button"</input>
</form>

controller:

  confirm: function (req, res) {
    var file = new Parse.File(req.files.picture.name, req.files.picture);

    file.save().then(function(file) {
        console.log('FILE: '+ file);
    }, function(error) {
        console.log('ERROR: '+ error.message);
    });
  }),

req.files.picture is defined, I don't understand why save does not work.

Could you help me ?

To save uploaded file to a specific location use the following

var fs = require('fs');

fs.readFile(req.files.picture.path, function (err, data) {
   fs.writeFile('pathYouWantToSaveFile', data, function(err, result){
      // done
      // delete the file from temp location
      fs.unlink(req.files.picture.path);
   });
});

NB: req.file.picture.path is the temporary location where the file is uploaded.

to make use Parse.File you can try the following (not tested though).

var fs = require('fs');

    fs.readFile(req.files.picture.path, function (err, data) {
       var file = new Parse.File('pathYouWantToSaveFile', data);
       file.save().then(function(file) {
          console.log('FILE: '+ file);
       }, function(error) {
          console.log('ERROR: '+ error.message);
       });
    });