I have use expo-image-picker and axios 0.26.1. formData in axios version 0.26.1 isn’t work. when using formData, data is not sent to the api
downgrade axios to version 0.24.0 but I get this error when sending formData in Android emulator.
Error: Network Error
formData:
export const sendRequest = (url, response, method, formData) => {
return axios({
url,
method,
data: method !== "get" ? formData : null,
headers: {
Authorization: `Bearer ${response.data.access}`,
headers: { "Content-Type": "multipart/form-data" },
transformRequest: (data, headers) => {
return formData;
},
},
});
const formData = new FormData();
const imageUri = image.value.uri;
const newImageUri = "file:///" + imageUri.split("file:/").join("");
formData.append("photo", {
uri: newImageUri,
type: mime.getType(newImageUri),
name: newImageUri.split("/").pop(),
});
data.append("title", title);
can you help me please?