[ERR_INVALID_CALLBACK]: Callback must be a function
i use jquery-file-upload-middleware to upload my images to the server but it's crashed everytime !! this my config:
upload.configure({ uploadDir:'./store/test', uploadUrl: '/store/test',
}) app.use('/toto', upload.fileHandler());
in the front:
** the picture is uploaded but the app crashed and this is what i get :**
fs.js:136 throw new ERR_INVALID_CALLBACK(); ^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:136:11)
at Object.unlink (fs.js:938:14)
at ReadStream.
Hi there! I follow this path:
\node_modules\jquery-file-upload-middleware\lib\uploadhandler.js:149:48
, after that I found solution here:
https://stackoverflow.com/questions/53583183/i-have-got-typeerror-err-invalid-callback-callback-must-be-a-function/53591136
I changed this unlink to unlinkSync. It worked!
if (!err) { **fs.unlinkSync(file.path);** generatePreviews(); }