Download pictures

Hi everybody,

I would like to store an array of pictures into a database (php and mysql) from react native. Like this i will be able to read it from any device. For the moment I stored the uri of the pictures in my database. But the problem is that using the uri from a determined device it is impossible to read it from another device. Thus, the idea is to store the picture in my database and then read the path to show the picture. Nevertheless, the problem is that when i send the data(array of pictures) through axios process I received an empty array of $_FILES and I don’t really know where is the problem. Below my code:

react:
const insertPhotos = (values,idDocument) =>
const data = new FormData();
data.append(‘image’,values.image[0]);
var InsertAPIURLPhotos =Network.InsertPhotos;
axios.post(InsertAPIURLPhotos,data,{config:{headers:{‘Content-Type’:‘multipart/form-data’}}})
.then((response)=>console.log(response))
.catch((response)=>console.log(response))
// .then((text)=>console.log(text))

};

Php:

<?php error_reporting(E_ALL); ini_set("display_errors",1); include "BddConnect.php"; $EncodedData=file_get_contents('php://input'); $DecodedData=json_decode($EncodedData,true); print_r($_FILES); $UrlPhoto=$DecodedData['values']['image']; $DocumentType=$DecodedData['values']['DocumentType']; $idDocument=$DecodedData['idDocument']; $ID=$DecodedData['IdentificationProps']['id']; foreach ($UrlPhoto as $element) { if (isset($_FILES['image']) AND !empty($_FILES['image']['name'])) { $taillemax=2097152; $extensionsvalides=array('jpg','jpeg','gif','png'); if ($_FILES['image']['size']<=$taillemax) { $extensionUpload=strtolower(substr(strrchr($_FILES['image'], '.'), 1)); if (in_array($extensionUpload,$extensionsvalides)) { $chemin="Photos/".$ID."_". rand()."_".time().".".$extensionUpload; $resultat=move_uploaded_file($_FILES['image']['tmp_name'], $chemin); } else { $msg='Vos photos doivent etre au format jpg,jpeg,gif ou png' ; } } else { $msg='Vos photos ne doivent pas dépasser 2 Mega octets'; } } // } ?>

Could you please help me ?