0

I am trying to create an upload field ( class based ) using react-final-form

Strangely documentation does not contain any info regarding this. Is there any way to implement this?

I am getting a junk file link that is not useful to upload the file to the server.

please help

2 Answers 2

1

also you might want to consider using something like
https://github.com/tim-mccurrach/react-final-form-file-field

Sign up to request clarification or add additional context in comments.

1 Comment

this is not compatible with react 17
0

you might want to consider using something like react-dropzone. I did mix it up with react-final-form in my last projects & it worked fine. I stripped it off the validation logic & some other extra stuff, & uploaded it for you here. it's not class-based, but I hope you can work from here.

5 Comments

It's a real pain with that package. I ended up using default react with states to handle this which gives better control.
@user3697484 could you show an example thanks
that's not true. it only gets submitted after clicking the submit button. check your console.
i think you should check your console in your sanBox, and you will see that when you click on "choose file", console print 'undefined' tha is the result of the submit of your form that has a console.log(),
ok. I see what you mean. it was because a type prop with the value "submit" was being passed to it from the parent by default, so an override of that to type="button" fixed it. . recheck the sandbox. it's fixed now. thanks for bringing it up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.