You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to upload video file from react-native camera to node server on localhost but the the control is not going inside upload function. I did a console log of the FileUpload object and it is coming as undefined.
Could some one please help.
startRecording = () => {
if (this.camera) {
this.camera.capture({mode: Camera.constants.CaptureMode.video})
.then((data) =>{
var FileUpload = require('NativeModules').FileUpload;
var obj = {
uploadUrl: 'http://10.0.1.196:8000/answer',
method: 'POST', // default 'POST',support 'POST' and 'PUT'
headers: {
'Accept': 'application/json',
},
fields: {
'hello': 'world',
},
files: [
{
name: 'answer', // optional, if none then filename is used instead
filename: 'answer.mp4', // require, file name
filepath: data.path, // require, file absoluete path
filetype: 'video/mp4', // options, if none, will get mimetype from filepath extension
},
]
};
alert("object made"+FileUpload)
FileUpload.upload(obj, function(err, result) {
alert('upload:', err, result);
})
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to upload video file from react-native camera to node server on localhost but the the control is not going inside upload function. I did a console log of the FileUpload object and it is coming as undefined.
Could some one please help.
startRecording = () => {
if (this.camera) {
this.camera.capture({mode: Camera.constants.CaptureMode.video})
.then((data) =>{
var FileUpload = require('NativeModules').FileUpload;
var obj = {
uploadUrl: 'http://10.0.1.196:8000/answer',
method: 'POST', // default 'POST',support 'POST' and 'PUT'
headers: {
'Accept': 'application/json',
},
fields: {
'hello': 'world',
},
files: [
{
name: 'answer', // optional, if none then
filename
is used insteadfilename: 'answer.mp4', // require, file name
filepath: data.path, // require, file absoluete path
filetype: 'video/mp4', // options, if none, will get mimetype from
filepath
extension},
]
};
alert("object made"+FileUpload)
FileUpload.upload(obj, function(err, result) {
alert('upload:', err, result);
})
Thanks
The text was updated successfully, but these errors were encountered: