在foreach中卷曲上传文件更改我的帖子值

时间:2018-07-31 00:34:29

标签: php api curl file-upload

我有存储区,并且开始扫描目录仅获取jpg文件,并在开始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
    }
}

当我上传1700张或更多图片时 卷曲开始更改我的

  

$ _ POST ['dir']

例如在1210幅图片中更改了我的

  

$ _ POST ['dir']

来自

  

“ / var / www / xxx / test /”

  

“ / var / www / xxx / te / va / www / x”

像这样 谁知道在这种情况下是什么问题,谢谢。

0 个答案:

没有答案