Is it possible to upload file (Image) to Django rest api from Reactjs client using Formik ?
Asked
Active
Viewed 325 times
1 Answers
0
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?

Sami Tahri
- 1,077
- 9
- 19
-
Yes but the problem is that i can't send the file using axios – rahim bait Feb 21 '22 at 20:33
-
What do you mean you can't ? You can through almost any known http client. https://stackoverflow.com/questions/43013858/how-to-post-a-file-from-a-form-with-axios for axios e.g. Angular has it's own too. – Sami Tahri Feb 21 '22 at 20:42
-
yes if you look to the response you will find out that is using formData and not formik – rahim bait Feb 21 '22 at 20:57
-
Did you check this ? https://stackoverflow.com/a/56161034/10034177, it uses formik with html element to set the file into the attribute of a native element. – Sami Tahri Feb 21 '22 at 22:51