Tuesday, 4 April 2017

How to delete file after upload using node?

I am using multiparty to upload some file on the server, I have notice that when using form.parse a file is being added in temp in SO file system.

I need to remove that file after form close but I cannot get information of file path.

Any idea how to solve this problem?

function onUpload(req, res) {
  var form = new multiparty.Form();

  form.parse(req, function(err, fields, files) {
    onSimpleUpload(fields, files[fileInputName][0], res);
  });

  // Close emitted after form parsed
  form.on('close', function() {
    // cannot get file here to be deleted
  });
}



via Radex

No comments:

Post a Comment