不可能进行必要的数据倒带

necessary data rewind wasn't possible

我正在尝试将用户上传的文件上传到 WebDav 服务器,但出现以下错误。

"necessary data rewind wasn't possible"

这是我的代码。

$config = Zend_Registry::get('settings')->documents;

$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination($config->temp_dir);

if($upload->isValid()){
    $upload->receive();

    foreach($upload->getFileInfo() as $fileInfo){
        if (!isset($fileInfo['name']) || empty($fileInfo['name'])){
            continue;
        }

        $fileName = $fileInfo['name'];
        $filePath = $config->temp_dir . $fileName;
        $fileSize = filesize($filePath);
        $file = fopen($filePath, 'r');

        $remoteUrl = $config->webdav_url;

        $credentials = array(
                'test',
                'test'
        );

        $ch = curl_init($remoteUrl . $fileName);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch, CURLOPT_USERPWD, implode(':', $credentials));
        curl_setopt($ch, CURLOPT_PUT, true);
        curl_setopt($ch, CURLOPT_INFILE, $file);
        curl_setopt($ch, CURLOPT_INFILESIZE, $fileSize);
        curl_close($ch);
        fclose($file);
    }
} else { // show the errors}

但是,当我尝试将本地文件上传到 WebDav 服务器时,它工作正常。

提前致谢!

错误的原因是文件名中的space。