I'm not quite sure what to say about how to reproduce.
POST a file using PHP-cURL to a server that doesn't support chunked mode.
I'm using https://sandbox.zenodo.com, but this requires a free account and utilizing their API, which seems beyond the scope of what I should put in a comment. Here is a sample similar to what I'm doing, with url/token/file removed:
-----------------
<?php
$url = '';
$access_token = '';
$file = '';
$ch = curl_init($url);
$options = [
CURLOPT_CUSTOMREQUEST => 'POST,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $access_token,
'Content-Type: multipart/form-data',
],
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POSTREDIR => 3,
CURLINFO_HEADER_OUT => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,//this has no effect
];
$file = curl_file_create(realpath($file), null, basename($file));
$data = ['file' => $file, 'name' => basename($file)];
$options[CURLOPT_POSTFIELDS] = $data;
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$curl_info = curl_getinfo($ch);
$curl_error = curl_error($ch);
curl_close($ch);
This works in Ubuntu 18, but not Ubuntu 20. To make it work in 20 I have to additionally empty the Transfer-Enconding header and determine and set the Content-Length header. This should not be necessary:
$options[CURLOPT_HTTPHEADER][] = "Transfer-Encoding: ";
//not sure how to determine $size
$options[CURLOPT_HTTPHEADER][] = "Content-Length: $size"
I'm not quite sure what to say about how to reproduce.
POST a file using PHP-cURL to a server that doesn't support chunked mode.
I'm using https:/ /sandbox. zenodo. com, but this requires a free account and utilizing their API, which seems beyond the scope of what I should put in a comment. Here is a sample similar to what I'm doing, with url/token/file removed: CUSTOMREQUEST => 'POST, RETURNTRANSFER => true, HTTPHEADER => [ Authorization: Bearer ' . $access_token, Content- Type: multipart/ form-data' , SSL_VERIFYHOST => 2, FOLLOWLOCATION => true, POSTREDIR => 3, HEADER_ OUT => true, HTTP_VERSION => CURL_HTTP_ VERSION_ 1_1,//this has no effect create( realpath( $file), null, basename($file)); CURLOPT_ POSTFIELDS] = $data; array($ ch, $options);
-----------------
<?php
$url = '';
$access_token = '';
$file = '';
$ch = curl_init($url);
$options = [
CURLOPT_
CURLOPT_
CURLOPT_
'
'
],
CURLOPT_
CURLOPT_
CURLOPT_
CURLINFO_
CURLOPT_
];
$file = curl_file_
$data = ['file' => $file, 'name' => basename($file)];
$options[
curl_setopt_
$response = curl_exec($ch);
$curl_info = curl_getinfo($ch);
$curl_error = curl_error($ch);
curl_close($ch);
This works in Ubuntu 18, but not Ubuntu 20. To make it work in 20 I have to additionally empty the Transfer-Enconding header and determine and set the Content-Length header. This should not be necessary: CURLOPT_ HTTPHEADER] [] = "Transfer-Encoding: "; CURLOPT_ HTTPHEADER] [] = "Content-Length: $size"
$options[
//not sure how to determine $size
$options[