下午,
通过curl发送大文件时遇到一些问题,我们可以发送第一个5mb,但是第二个测试文件是34mb,并且没有发送。我们增加了发送和接收服务器上的帖子大小和最大上传大小,但仍然没有乐趣。
这是发送脚本:
apt-mark showhold
接收脚本:
sudo apt-mark unhold <package name>
我们当前遇到的错误是:
function send_files($directory, $file, $dir_parts) {
$url = 'https://test.com/App_processing/transfer_videos';
$handle = fopen($directory."video.mp4", "r");
$stats = fstat($handle);
$data = stream_get_contents($handle);
$payload = array(
'file' => base64_encode($data),
'parts' => $dir_parts
);
$postfields = array( serialize( $payload ) );
$ssl = strstr($url, '://', true);
$port = ($ssl == 'https') ? 443 : 80;
$verify_ssl = false;
$ch = curl_init();
$curlConfig = array(
CURLOPT_PORT => $port,
CURLOPT_URL => $url,
CURLOPT_SSL_VERIFYPEER => $verify_ssl,
CURLOPT_FORBID_REUSE => true,
CURLOPT_FRESH_CONNECT => true,
CURLOPT_FAILONERROR => false,
CURLOPT_VERBOSE => true,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_COOKIESESSION => true,
CURLOPT_POSTFIELDS => $postfields,
);
$headers = null;
$apikey = 'testAPIkey';
$headers = array(
"apikey: ".$apikey
);
$curlConfig[CURLOPT_HTTPHEADER] = $headers;
curl_setopt_array( $ch, $curlConfig );
$response = curl_exec( $ch );
}
我们到底在做什么错了?