Is it possible to upload file (Image) to Django rest api from Reactjs client using Formik ?
2 Answers
Django/DRF allows to upload file quite easly : https://docs.djangoproject.com/fr/2.2/topics/http/file-uploads/ and for DRF : Django Rest Framework File Upload
As for Formik: ReactJS: How to handle Image / File upload with Formik?
4 Comments
rahim bait
Yes but the problem is that i can't send the file using axios
Sami Tahri
What do you mean you can't ? You can through almost any known http client. stackoverflow.com/questions/43013858/… for axios e.g. Angular has it's own too.
rahim bait
yes if you look to the response you will find out that is using formData and not formik
Sami Tahri
Did you check this ? stackoverflow.com/a/56161034/10034177, it uses formik with html element to set the file into the attribute of a native element.