Skip to content
Snippets Groups Projects
Commit 32a70724 authored by Druganov Demid's avatar Druganov Demid
Browse files

fix file upload

parent 0cc5ce13
Branches
Tags 0.2.2
No related merge requests found
......@@ -72,8 +72,7 @@ final class BitrixCloudApi
{
$result = BitrixRequest::get('disk.folder.uploadfile', [
'id' => $folderId,
'data' => ['NAME' => "{$fileData->getHash()}.{$fileData->getName()}"],
'generateUniqueName' => true
'data' => ['NAME' => $fileData->getName()],
]);
$uploadUrl = $result['result']['uploadUrl'] ?? null;
......@@ -89,7 +88,11 @@ final class BitrixCloudApi
CURLOPT_URL => $uploadUrl,
CURLOPT_HEADER => 0,
CURLOPT_POSTFIELDS => [
'file' => curl_file_create($fileData->getPath())
'file' => curl_file_create(
filename: $fileData->getPath(),
mime_type: $fileData->getMimeType(),
posted_filename: $fileData->getName()
)
]
]);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment