1

I'm trying to store an uploaded file,the file reached the server successfully but don't know how to store it using the multiparty library that's the code:

    var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
app.post('/upload_audio', multipartMiddleware, function(req, resp) {
  console.log(req.body, req.files);
 if(req.files){
     resp.status(200).send("Uploaded!!!");
 }
});

1 Answers1

2

By default the 'connect-multipart' module save the file in a default file which is
"C://Users//ur-username//AppData//Local//Temp" but you can change it by adding this line :

app.use(multipart({ uploadDir: "ur_path"}));
  • thanks for the answer it helped me. But, I wanted to rename the file as per my need. Can you tell me how can I achieve that – Gopi P Jun 14 '20 at 02:19