itinance / itinance/react-native-fs

cannot be cast from Double to String for android

Open
#855 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

"react": "16.9.0",
"react-native": "0.61.5",
"react-native-fs": "2.16.4",

below code work properly in ios but not working on android it getting error casting error
```

var data = new Object();
data['intUserId'] = 5;
data['intActivityId'] = 8;
data['strStatus'] = 'OK';

RNFS.uploadFiles({
toUrl: url,
files: [{
name: fileKey,
filename: file.name,
filetype: file.type,
filepath: filePath,
}],
method: 'POST',
headers: {
//'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
//'Accept': 'application/json',
'Accept': 'multipart/form-data',
'Authorization': 'Basic ' + Base64.btoa(basicAuthUserName + ':' + basicAuthPassword),
},
fields: data,
begin: ()=>{console.log("Uploading start")},
progress: (response) => {
var percentage = Math.floor((response.totalBytesSent/response.totalBytesExpectedToSend) * 100);
console.log('UPLOAD IS ' + percentage + '% DONE!');
}
})
.promise.then((response) => {
console.log(JSON.stringify(response));
if (response.statusCode == 200) {
console.log("FILES UPLOADED!");
console.log("Response :" + response.body);
} else {
console.log("SERVER ERROR");
}
})
.catch((error) => {
console.log("Exception :- " + error);
//alert("Exception :- " + error);
});
```

> Exception :- Error: Value for intUserId cannot be cast from Double to String

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.