get path video file with react native image picker:
{path: "/storage/emulated/0/DCIM/Camera/VID_20171123_122202.mp4", uri:
"content://media/external/video/media/50"}
send file with react native fetch blob with wrap:
let url=CounterStore.base_url+'upload/video?
&api_token='+CounterStore.api_token;
RNFetchBlob.fetch('POST', url, {
'Content-Type' : 'multipart/form-data',
}, [
// part file from storage
{ name : 'avatar-foo', filename : 'avatar-foo.png',
type:'image/foo', data: RNFetchBlob.wrap(this.state.data.path)},
// elements without property `filename` will be sent as plain text
{ name : 'name', data : 'user'},
{ name : 'info', data : JSON.stringify({
mail : 'example@example.com',
tel : '12345678'
})},
]).then((resp) => {
console.log(resp)
}).catch((err) => {
console.log(err)
})
not return video data in server:
`FetchBlobResponse {data: "{"name":"user","info":"{\"mail\":\"example@example…p8njbIxpJGLDA8fte6QEgbWQOVU3Vhf","avatar-foo":{}}", taskId: "8f`vfiutibvhss2jt8eh62", type: "utf8", respInfo: {…}, info: ƒ, …}
avator-foo is empty.why?
Three Problems with your code ...
check example given below