I am trying to upload my video to backend server using FormData. But when uploading video file, I am getting string value instead of video file in backend. Thank you
const formData = new FormData();
formData.append('dare_id', `${encrypted_id}`);
formData.append(
'video',
Platform.OS === 'android'
? uri //local video file uri
: uri.replace('file://', ''), //local video file uri
);
fetch(UPLOAD_URL, {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
body: formData,
})
.then(res => res.json())
.then(responseJson => {
console.log(responseJson);
})
.catch(error => {
console.log(error, ' error uploading');
});