使用反应原生图像选择器获取路径视频文件:
{path: "/storage/emulated/0/DCIM/Camera/VID_20171123_122202.mp4", uri:
"content://media/external/video/media/50"}
使用带有包装的本机获取 blob 发送文件:
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)
})
不返回服务器中的视频数据:
`FetchBlobResponse {data: "{"name":"user","info":"{\"mail\":\"example@example…p8njbIxpJGLDA8fte6QEgbWQOVU3Vhf","avatar-foo":{}}", taskId: "8f`vfiutibvhss2jt8eh62", type: "utf8", respInfo: {…}, info: ƒ, …}
avator-foo 是空的。为什么?