Wednesday, 15 March 2017

File Upload using node js without multer

Just want simple file upload functionality . I have used fs-path that serves my purpose of creating dynamic folder structure and file at upload location. I am not able to achieve streaming of request file, that will have to be uploaded. My code is as follows :

fsPath.writeFile(path, **req.body**, function (err) {
    if (err) {
      throw err;
    } else {
      console.log('File Upload successful...');
      res.send({ code: 200, message: `File Upload successful` });
    }
  });

Need some insights about, how can I send request file as input in above code snippet. How do i steam my request file, that will be written in respective upload location.



via ninad kelkar

No comments:

Post a Comment