Response sent before the files are actually available #1138
Faber-smythe
started this conversation in
General
Replies: 1 comment
-
I think you can do a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I didn't feel like opening an issue for this, I was mostly wondering if I understand things right.
I have a setup with Nuxt and Express, and I am using multer.array() to upload two files at once. And basically the app needs to be notified when the upload is done in order to use the new images, but the callback is fired before the files are available.
From what I gathered, multer is part of the router chain, so in the below code, the post handler is supposedly fired once the file are done uploading.
Back in the app, I can receive the response and log the file object just fine, something like this.
So the object is available. But when I want to use the filename to fetch the newly uploaded image, it throws an error because the file is not available yet. I came to this conclusion because when I use setTimeout for about 4000ms it solves the issue.
Does this problem sound familiar to anybody ?
Beta Was this translation helpful? Give feedback.
All reactions