I have an array of Files that i want to retrieve in php along with some other string params, When i send the file(s) from the FormData
in React they're being received as json in php :
"{"dataForm":{"Files":[{"path":"aust.jpeg"}]},"headers":{"content-type":"multipart/form-data"}}"
I want to receive them in $_FILES instead for obvious reasons, is it possible to do that and read the rest of the params as json in php ? Also my php.ini is fully configured to allow file uploads
Here is the Reactjs code :
import axios from 'axios';
const sendMail = (data, uploadedFiles) => {
const dataForm = new FormData();
dataForm['Files'] = uploadedFiles; // Here uploadedFiles is an array of files
console.log(dataForm['Files'])
axios.post('http://localhost/bickdata/mail/SendMail.php', {
dataForm,
headers: {
'content-type': 'multipart/form-data'
}
}) .then(function (response) {
console.log(response);
});
}
Thanks in advance !