Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERR_INVALID_CALLBACK]: Callback must be a function #85

Open
moharm opened this issue Sep 3, 2019 · 1 comment
Open

[ERR_INVALID_CALLBACK]: Callback must be a function #85

moharm opened this issue Sep 3, 2019 · 1 comment

Comments

@moharm
Copy link

moharm commented Sep 3, 2019

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. (D:\disktop\Stage 2\gestion d'absence\projet\node_modules\jquery-file-upload-middleware\lib\uploadhandler.js:149:48)
at ReadStream.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

@hungvuongwork
Copy link

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(); }

brianbolt added a commit to mcneilco/acas that referenced this issue Dec 6, 2020
removing unused routes which dont map to real functions
fixing indenting issues
prepare module includes comment structure
super -> super()
fixing winston
memory store
jquery file upload #TODO: fixing unlink async aguidrevitch/jquery-file-upload-middleware#85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants