`<form method=“post” enctype=“multipart/form-data”>
<input type=“file” name=“photo1” accept=“image/" capture>
<input type=“file” name=“photo2” accept="image/” capture>
<input type=“submit” name=“submit” value=“Submit”>
</form>
$file2 = $_FILES[‘photo2’][‘tmp_name’];
$file1 = $_FILES[‘photo1’][‘tmp_name’];
file1,
‘photo2’ => ‘@’.data);
curl_setopt_array($curl, [
CURLOPT_URL => "https://face-verification2.p.rapidapi.com/FaceVerification",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
"content-type: application/x-www-form-urlencoded",
"x-rapidapi-host: face-verification2.p.rapidapi.com",
"x-rapidapi-key: -"
],
]);`
someone can help me ?
Doe mee aan de discussie - voeg hieronder een opmerking toe
i always get this message
string(87) "{"hasError":true,"statusCode":400,"statusMessage":"There aren't any files in Request."}"
whether my data POSTFIELD is correct ?
<form action="test.php" encoding='multipart/form-data' method="post" enctype="multipart/form-data"> <input type="file" name="photo1" accept="image/*" capture> <input type="file" name="photo2" accept="image/*" capture> <input type="submit" name="submit" value="Submit"> </form>
$file1 = $_FILES['photo1']["tmp_name"];
$file2 = $_FILES['photo2']["tmp_name"];
curl_setopt_array($curl, [
CURLOPT_URL => “https://face-verification2.p.rapidapi.com/FaceVerification”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
“content-type: multipart/form-data”,
“x-rapidapi-host: face-verification2.p.rapidapi.com”,
“x-rapidapi-key: -”
],
]);`
change content-type in CURLOPT_HTTPHEADER:
"content-type: application/x-www-form-urlencoded"
, ---->"content-type: multipart/form-data"
.