i am learning react native using the expo cli but i'm stuck trying to upload an image to django rest framework using "expo-image-picker" but i get an error "The submitted data was not a file. Check the encoding type on the form."
const pick = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
});
if (!result.cancelled) {
setImage(result);
}
}
const handleSubmit = () => {
let form_data = new FormData();
form_data.append(image);
instance({
method: "post",
url: "http://127.0.0.1:8000/API/Create_item",
data: form_data,
headers: { "Content-Type": "multipart/form-data" },
})
}