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

Feature: Extendable fileUploader #248 #464

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Feature: Extendable fileUploader #248 #464

wants to merge 4 commits into from

Conversation

dotMortis
Copy link

Feature: Extendable fileUploader #248

@dotMortis dotMortis changed the title 248 Feature: Extendable fileUploader #248 Nov 19, 2020
Copy link
Owner

@cdimascio cdimascio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Haruki-Mortis this looks pretty good.
that said, i'm still mulling over whether this is the right way to handle it
can you describe again why we need pre and post middleware?

also, please let me know if you have any thoughts on how this could be handled without requiring pre and post middleware. i understand this may not be possible and (if possible) may require a significant overhaul. that said, now that you've been in the code, you likely have a decent idea of what is and isn't possible. im hoping you might also have thoughts on how file upload might reimagined, so that it can be simpler

thanks a lot for this PR.

@setaman
Copy link

setaman commented Dec 22, 2020

@Haruki-Mortis @cdimascio I don't want to be bound to multer.any() as well and want to be able to provide custom uploader. My approach to implementing this is really simple. We can simply extend the fileUploader with an another prop, let's say uploadHandler, that is a function returned by multer().single("image") for example. Then instead of:

multer.any()(req, res, next) {...}.

we can do:

options.multOpts.uploadHandler(req, res, next) {...}

This is straightforward to implement and gives the user the ability to use multer without restrictions. I have already implemented and tested this approach exemplary, works fine. What do you say? Is this worth a PR?

@cdimascio
Copy link
Owner

@Haruki-Mortis good idea. this will provide good flexibility

@devthejo
Copy link

devthejo commented Mar 5, 2022

Hello, any news on this ?
I would like to use a custom implementation of multer too, to allow use of upload without multipart, like described here https://swagger.io/docs/specification/describing-request-body/file-upload/
Let me know if a new PR is welcome on this.
PS: Thanks for this great tool you built !

@cdimascio
Copy link
Owner

@devthejo I support the idea and welcome PRs.

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

Successfully merging this pull request may close these issues.

5 participants