I am using Sails JS v11.05.
The file upload is NOT a required field.
How do I check if the file was uploaded or not?
Usually, I use
if (!req.param('param')) {
// param does NOT exist - was not uploaded
// This does not apply to file input params.
}
// However, the following will break as it will start a listener (upstream)
if (!req.file('param')) {
// File was not uploaded
}
All I want to know whether a file is an input or not so I don't bother to call req.file('file').upload() if it wasn't uploaded.
Ideas?