# React-Native Error when Uploading File Social SDK

**URL:** https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381
**Category:** General
**Created:** [January 24, 2022, 11:16am UTC](https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381 "2022-01-24T11:16:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dlartor](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@dlartor](https://forum.social.plus/u/dlartor)
#### Post date: [January 24, 2022, 11:16am UTC](https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381/1 "2022-01-24T11:16:53Z")

</div>

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:

```auto
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:

```auto
{
    "status": "error",
    "message": "Input file contains unsupported image format",
    "code": 500000,
    "data": {}
}

```

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [January 25, 2022, 11:00am UTC](https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381/2 "2022-01-25T11:00:45Z")

</div>

Hi @dlartor please have a look at this code sample [Amity-Social-Cloud-React-Native-Sample-App/AddFile.tsx at 5ee8a7163f9e7a27fb9f712787c22415d3a018aa · AmityCo/Amity-Social-Cloud-React-Native-Sample-App · GitHub](https://github.com/AmityCo/Amity-Social-Cloud-React-Native-Sample-App/blob/5ee8a7163f9e7a27fb9f712787c22415d3a018aa/src/components/AddPost/AddFile.tsx#L35) and if you have further questions please let us know 🙏😊

---

<div class="post-metadata">

### Author: ![dlartor](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@dlartor](https://forum.social.plus/u/dlartor)
#### Post date: [January 25, 2022, 11:21am UTC](https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381/3 "2022-01-25T11:21:33Z")

</div>

Yes I actually based my code in the code on the Sample you provide. It’s still not working

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [January 27, 2022, 1:18pm UTC](https://forum.social.plus/t/react-native-error-when-uploading-file-social-sdk/381/4 "2022-01-27T13:18:01Z")

</div>

Hello @dlartor we have updated our docs here [https://docs.amity.co/chat/typescript/file-handling#create-files](https://docs.amity.co/chat/typescript/file-handling#create-files) , if you already follow this and still get the error, could you please help upload your code on git and send it to us? we will have the team to look into it 🙏
