jannikbuschke / formik-antd

Simple declarative bindings for Ant Design and Formik.
https://codesandbox.io/s/github/jannikbuschke/formik-antd-example
MIT License
589 stars 81 forks source link

Include the Upload component. #120

Open fabmont opened 4 years ago

fabmont commented 4 years ago

The upload component is quite important for some forms and maybe including this into the component list should be nice.

jannikbuschke commented 4 years ago

If I am not mistaken the ant design component directly initiates an upload to a server.

I imagine you would want to somehow "stage" some files, and then upload them when the user clicks a "form submit" button? I am not sure if this can be easily implemented.

fabmont commented 4 years ago

Yeah, I'm talking about staging files. The user will select some files and when he hits the submit button, our app should send the binaries to our backend. I think it is possible to implement.

jannikbuschke commented 4 years ago

In the ant design docs https://ant.design/components/upload/ there is an Upload manually example, with which it should be rather straight forward to implement this functionality.

Im not sure if the file contents should be put into the formstate itself, or rather just into a component state.

fabmont commented 4 years ago

It's a good point... I'll try this later and see how it works and I'll also try using Formik too to see the differences.

lovetoburnswhen commented 3 years ago

@fabmont were you able to get it working?

jannikbuschke commented 3 years ago

@Frank5000 I implemented an UploadFile component in my (undocumented, not yet releasable) glow library: https://github.com/jannikbuschke/glow/blob/master/core/web/src/files/upload-files.tsx#L31 There I use ant designs upload component to upload files to my backend. On successfull uploads I reference these already uploaded files in my local formik form. So when I send the form, I only reference already uploaded files, if this makes sense.

Frostbourn commented 3 years ago

Hi, any news on that feature?