react-native-file-upload icon indicating copy to clipboard operation
react-native-file-upload copied to clipboard

Can't connect to node server

Open himanshujobletics opened this issue 8 years ago • 0 comments

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

himanshujobletics avatar Aug 15 '17 14:08 himanshujobletics