CURD Multi media like image with react expo

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

hi i create a backend whit strapi
i create a content-type like this
name (text)
image(media)

but I try and test every query with axios and fetch in react native(expo) but I can’t send image to strapi
please help meee
how can I send image to strapi with react native expo easily ?
:cold_face: :cold_face: :cold_face: :weary: :weary: :weary:

Welcome to the Strapi Community Forums @hassanra :cake:

I suggest you need to use populate

So you need to populate the media to access it

Hi, Thank you for response.
I use react native expo, I search in internet for three days :weary: :weary: :weary: but i couldn’t find any correct solution for expo.

NOTICE : All my queries are correct and work in postman for upload file to strapi or create any new entry that it has a image filed.
but when i want use in expo don’t work

please help me :pray: :pray: :pray: :pray:

I write all kind changes that I find in internet.

when I want create an entry, just create fields that not files.

1 Like
if (files) {
          const formData = new FormData();
          const filename = files.substring(files.lastIndexOf("/")+1);
          formData.append("files" , {
            uri : files,
            type : "image/jpeg",
            name : filename ,
          })
          const response = await GlobalApi.setTestData(formData).then((rep) => {
            console.log("Image uploaded successfully:", rep);
          })