Поддерживаются только потоки простых файлов - PullRequest
0 голосов
/ 05 января 2020

Я пытаюсь загрузить документ, удостоверяющий личность, в полоску,

У меня также есть базовая c авторизация на моем сервере, вот код

$b64 = base64_encode("$username:$password");
$auth = "Authorization: Basic $b64";
$opts = array(
    'http' => array(
        'method' => "GET",
        'header' => $auth,
        'user_agent' => 'bob',
    )
);
$context = stream_context_create($opts);
$fp = fopen($url, 'r', false, $context);

У меня есть следующий код для загрузки файл в полоску

 \Stripe\FileUpload::create(
 array(
 "purpose" => "identity_document",
 "file" => $fp
 )
 );

, но когда я пытаюсь открыть файл, он выдает мне следующую ошибку

Api in ApiRequestor.php line 249:
Only plainfile resource streams are supported
in ApiRequestor.php line 249
at ApiRequestor->_processResourceParam(resource, true) in ApiRequestor.php line 210
at ApiRequestor->_requestRaw('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), array()) in ApiRequestor.php line 64
at ApiRequestor->request('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), array()) in ApiResource.php line 119
at ApiResource::_staticRequest('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), null) in ApiResource.php line 158
at ApiResource::_create(array('purpose' => 'identity_document', 'file' => resource), null) in FileUpload.php line 49
at FileUpload::create(array('purpose' => 'identity_document', 'file' => resource)) in ProfileController.php line 959
...