I have derectory and start scan dir get only jpg files and put in array after start foreach
foreach(files as file) {
$cfile = new CURLFile('HERE FULL PATH TO FILE', $mime, $file);
$target_url = "https://xxxxx.com/api/handler.php";
$data = array('file' => $cfile, 'dir' => 'Derectory where need upload file if not exist i create in handler.php for example /var/www/xxx/test/');
$ch = curl_init($target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // On dev server only!
$result = curl_exec($ch);
if ($result) {
curl_close($ch);
// do something
} else {
curl_close($ch);
// error
}
}
when I upload 1700 or more images curl start change my
$_POST['dir']
for example in 1210-rd image that change my
$_POST['dir']
from
"/var/www/xxx/test/"
to
"/var/www/xxx/te/va/www/x"
like this who know what the problem in this case Thanks.