itinance / itinance/react-native-fs
File Upload to asp.net core api
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
**Using the following implementation**
RNFS.uploadFiles({
toUrl: "api/endpoint",
files: files,
method: 'POST',
headers: {
'Accept': 'application/json',
},
fields: {
'hello': 'world',
},
begin: uploadBegin,
progress: uploadProgress
}).promise.then((response) => {
if (response.statusCode == 200) {
console.log('FILES UPLOADED!');
} else {
console.log('SERVER ERROR');
}
})
.catch((err) => {
if (err.description === "cancelled") {
// cancelled by user
}
console.log(err);
});
}
**from IOS produces this error**
System.IO.IOException: Unexpected end of Stream, the content may have already been read by another component. at Microsoft.AspNetCore.WebUtilities.MultipartReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at System.IO.StreamReader.ReadBufferAsync() at System.IO.StreamReader.ReadToEndAsyncInternal() at Microsoft.AspNetCore.WebUtilities.MultipartSectionStreamExtensions.ReadAsStringAsync(MultipartSection section) at Microsoft.AspNetCore.Http.Features.FormFeature.InnerReadFormAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Http.Features.FormFeature.ReadForm() at Microsoft.AspNetCore.Http.DefaultHttpRequest.get_Form() at PilotJetsApps.Controllers.SampleDataController.PostInspection()
Server side. which is saying that the file has been buffered away. I've added in the appropriate filters in my asp.net core engine and am still getting the error. Reading other issues with this library
Im leading towards the problem being related to this library. It is only happening on ios. Im using react-native-camera to get the image and it passes the correct uri to **RNFS.uploadFiles** and upload starts then finishes but nothing in storage except the listed error.
Version "react-native-fs": "^2.14.1",
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.