Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to node server #11

Open
himanshujobletics opened this issue Aug 15, 2017 · 0 comments
Open

Can't connect to node server #11

himanshujobletics opened this issue Aug 15, 2017 · 0 comments

Comments

@himanshujobletics
Copy link

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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant