если кто нибудь сюда придёт за решением, сокеты самое простое, что можно для этого использовать
function uploadFile($desource, $source, $name='file.txt', $field='file'){
$bodyend = $body = $head = $out = '';
$boundary = '-------------'. uniqid();
// $cipher = new \phpseclib3\Crypt\RC4();
// $cipher->setKey('qwertyuiop');
$source = parse_url($source);
$source['scheme'] = $source['scheme'] == 'http' ? '' : $source['scheme'];
$source['scheme'] = ($source['scheme'] == 'https' ? 'ssl' : $source['scheme']) . ($source['scheme'] ? '://' : '');
$source['port'] = $source['port'] ?? ($source['scheme'] == 'ssl://' ? 443 : 80);
$source['path'] = ($source['path'] ?? '/') . ($source['query'] ? ('?'. $source['query']) : '');
$size = filesize($desource);
$file = fopen($desource, 'rb');
$server = fsockopen("{$source['scheme']}{$source['host']}", $source['port']);
$body .= "--$boundary\r\n";
$body .= "Content-Disposition: form-data; name=\"$field\"; filename=\"$name\"\r\n";
$body .= "Content-Type: application/octet-stream\r\n\r\n";
$bodyend .= "\r\n";
$bodyend .= "--$boundary--\r\n\r\n";
$head .= "POST {$source['path']} HTTP/1.1\r\n";
$head .= "Host: {$source['host']}\r\n";
$head .= "Content-Type: multipart/form-data; boundary=$boundary\r\n";
$head .= 'Content-length: '. (strlen($body) + $size + strlen($bodyend)) ."\r\n";
$head .= "\r\n";
fputs($server, $head);
fputs($server, $body);
while(!feof($file)){
// fputs($server, $cipher->encrypt(fread($file, 16384)));
fputs($server, fread($file, 16384));
}
fputs($server, $bodyend);
while(!feof($server)) $out .= fread($server, 16384);
fclose($server);
return $out;
}