i have a expo app in which i am recording some audio and reading the audio as a base64 string and sending the string in post. it seems to be working but when audio file is bigger than a certain threshold (about 5mb or 30 second), it just sends the first 30 seconds. i can still play it if i download from storage where i am pushing the data. my code looks like this:
let formData = new FormData();
const apiUrl = 'https://manishtestserv.azurewebsites.net/api/myService/uploadfilev2';
const fileType = 'm4a';
const auditfilestring = await FileSystem.readAsStringAsync(recording.getURI(),{position:0,encoding :FileSystem.EncodingType.Base64});
console.log(`total length of string is ${auditfilestring.length}`)
formData.append('audiodata', auditfilestring);
formData.append("userid", "called by manish");
//formData.append("teststring", "called by manish shukla");
let options = {
method: "POST",
body: formData,
headers: {
Accept: "application/json",
"Content-Type": "multipart/form-data"
}
};
try{
axios({
method: 'post',
url: apiUrl,
data: formData,
headers: {'Content-Type': 'multipart/form-data' }
})
.then(function (response) {
//handle success
console.log(response.status);
console.log(response.data);
//console.log(response);
})
.catch(function (response) {
//handle error
console.log(response);
});
}
catch(error){
console.log('error in api call');
console.log(error);
}