Saving jpeg retreived from React via API in rawFile(blob)

57 Views Asked by At

Is there any option to save jpeg file sent via React as rawFile? So, frontend uses React-admin, on submitting it sends JSON encoded object of a structure like this:

{
  "id":8,
  "client_photo":{
    "rawFile":{
      "path":"DSC_2024.jpg"
    },
    "src":"blob:http://localhost/some-path",
    "title":"DSC_2024.jpg"
  }
}

I'm trying to save it on a server with PHP-script. The problem is that $_FILES and $_POST variables are empty, so the only source I have is that "src" field of the "client_photo" field received from React. How am I supposed to do that?

1

There are 1 best solutions below

2
On

Use filereader to read the file and convert it as per your requirement and save it in DB.