-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fileFilter not working #246
Comments
Hmm, are all the tests passing for you? Could you please try and clone this repo and run |
44 passing (552ms)
|
A strange thing happened as I changed all files in the repo to have LF line separators... at first they had CRLF as I cloned repo to my machine... anyway, now I have only 1 test failing
Any clues... so far ? :/ I am really bothered by this :( |
Hi tibortru, I had the same problem. Finally my solution was to give up multer's fileFilter and do the mimetype check on the temporary file inside app.post() . Files that do not pass the check are deleted. app.post('/upload/*', upload.single('image'), function(req, res, cb) { |
This worked for me:
|
Hello,
This help me process the error created if the fileFilter is false. hope it helps. |
const upload = multer({ |
still wondering what this line does |
if there an error, the "err" object have a "code" key. That line just check if the code throw in the error is a size related. |
I wrote about this here #192
I have multer 1.0.6 , node 4.1.2, express 4.13.3
And this in file filter:
When I send image file, everything works properly. But when I send something else like blabla.txt I expect error to return, but the request goes pending... in Chrome it says it is pending. After a couple of minutes I get response with net::ERR_EMPTY_RESPONSE.
I tried calling only
without
return
statement, same issue.The text was updated successfully, but these errors were encountered: