I have in postman this configuration: A post request form-data with two key: data and file. In data I have this json:
{"id_image": "23"}
and in key file I have an image.jpg
I need in my php backend code receive both the data: json, and image. I'm able to receive the json, but not the image.
$data= $_POST['data'];
$decoded = json_decode($data, true);
$id_image_from_json=null;
foreach($decoded as $key => $output) {
if($key === 'id_image') {
echo $id_image_from_json=$output; // echoes only id
}
}
//get file image
$file= $_POST['file'];
Does anyone know how to proceed? Thanks