Im using the following code to get single files/ zip from postman.
In the request im asking for a file original name and can check if the file originalname contain .zip or not ,is there a better way to check if it single file or zip ?
update function (req, res) {
if (req.file) {
I've had to do this in the past and the cleanest way I've found is to check the mimetype of the file from the request:
if(req.file.mimetype === 'application/zip')
Bonus being there's no need for external depedencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With