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

Checking some form data constraints before uploading. #465

Closed
radwasherif opened this issue Feb 27, 2017 · 1 comment
Closed

Checking some form data constraints before uploading. #465

radwasherif opened this issue Feb 27, 2017 · 1 comment

Comments

@radwasherif
Copy link

I basically want to validate some form data (e.g. certain fields are not empty, some input is in certain format.. etc.) before actually uploading the files.

What happens is that if I place a callback before the upload, req.body is empty.

Anyone solutions/workarounds for this?

@LinusU
Copy link
Member

LinusU commented Feb 27, 2017

From the documentation:

Note that req.body might not have been fully populated yet. It depends on the order that the client transmits fields and files to the server.

I wish I had an easy solution for you but the only thing I can recommend is to manually reorder the fields with javascript to make sure that fields are sent before files.

This has come up a number of times before, e.g. #322 and #146 where an workaround is outlined...

@LinusU LinusU closed this as completed Feb 27, 2017
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