Multer: Multer / Delete file

Created on 1 Feb 2018  路  6Comments  路  Source: expressjs/multer

Hello,

There is any way to delete file when delete doc ??

Bests.

Most helpful comment

That answer provides some guiding, basically you want to do something like:

fs.unlink(req.file.path, (err) => /* ... */)

All 6 comments

That answer provides some guiding, basically you want to do something like:

fs.unlink(req.file.path, (err) => /* ... */)

on my vps, after fs.unlink..... restart the app

@LinusU @adeelibr How can you expose fs.unlink in the Node / Express framework so that it can process API delete requests? Posts are exposed with an app.post(...) so is something similar needed to expose the delete request?

@NickEmpetvee do you mean app.delete(...) for processing delete request, is that what you want?

@haxer-max yeah that was what it was. I figured it out not too long after posting it. This was my first time coding with Node.

Was this page helpful?
0 / 5 - 0 ratings