Reputation: 73
I am sending a file name using axios from frontend using react js to my DRF api class now, i need to send that file name to my another api class using drf post method and search for file and return file as response.
I tried doing from backend and it worked, but when i try to using the post methods to post my file name i am unable to do it
I am usng Django and drf and my front end as react js
My frontend code looks something like this
fetchFile = (value) => {
const url = `${API}/dashboard/log_file/`;
const data = {
info :value
}
axios.post(url,{data}
)
};
Upvotes: 0
Views: 209
Reputation: 41
Did you try using formData? something like this .
const formData = new FormData()
formData.append('info', 'hogehoge')
axios.post(url,formData)
Upvotes: 0