Issue
I am new to react-native. I want to upload the video to the server. How to upload video using RNfetchBlob?
Anyone can help me? Thank you.
Solution
upladingVideo = () => {
RNFetchBlob.fetch('POST', YOUR_API_URL, {
'content-type': 'multipart/form-data',
"Accept":"multipart/form-data",
},[
{name: YOUR_VARIABLE_NAME, filename: ‘myvidoe.mp4', data: RNFetchBlob.wrap(YOUR_LOCAL_VIDEO_URL) },
]).then(response => response.json())
.then(response => {
if (response.status === 'success') {
// If you will get a success response from your api
alert(‘Video is uploaded successfully’);
} else {
alert(‘Something went wrong’);
}})
.catch((err) => {
alert(err);
})
}
Answered By - Nirmalsinh Rathod
Answer Checked By - - Pedro (ReactFix Volunteer)