I’m trying to upload a file to the Social SDK. I’m basing my code on your React Native Sample App. And I’m getting the following error:
Code:
const filename =
const response = await fetch('file://' + newFile)
const blob = await response.blob()
const fileObject = {
...blob,
name: 'profilepic.jpeg',
uri: 'file://' + newFile,
type: 'image/jpeg'
};
const data = new FormData() as any;
data.append('file', fileObject);
data.getAll = data.getParts;
const query = createQuery(createFile, data);
runQuery(createQuery(createFile, data), ({ data: fileData, error }) => {
if (fileData) {
console.log(fileData)
} else if (error) {
console.log(error);
}
});
Result:
{
"status": "error",
"message": "Input file contains unsupported image format",
"code": 500000,
"data": {}
}