itinance / itinance/react-native-fs
Uploading file to s3 is always setting binary content type
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Whenever I attempt to upload files to S3 using a presigned URL, I consistently encounter an issue where the correct content type is not being set, and instead, it consistently defaults to the binary type. What might be the underlying cause of this problem?
```
const {path} = await RNFS.stat(fileURI);
const files = [
{
name: 'file',
filename: fileName,
filepath: path,
filetype: fileType,
type: fileType,
},
];
const fields = {
Key: params.key,
Bucket: params[''],
Policy: params.policy,
AWSAccessKeyId: params.AWSAccessKeyId,
Signature: params.signature,
};
const response = await RNFS.uploadFiles({
toUrl: url,
files,
method: 'POST',
headers: {
Accept: 'application/json',
},
fields,
}).promise;
console.log(response);
return response;
} catch (exception) {
Logger.warn('Unable to upload to s3', exception);
return null;
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.