我正在使用一个驱动器成功上载端点及其上载文件来上载文件。但是,当我在线打开它时,显示错误文件已损坏。有什么问题?我的代码有问题吗?
**Controller**
$url = 'https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{items-id}:/test.xlsx:/createUploadSession';
$body = array(
"@microsoft.graph.conflictBehavior" => "rename | fail | replace",
"description" => "description",
"fileSystemInfo" => array("@odata.type"=> "microsoft.graph.fileSystemInfo"),
"name" => "umair.xlsx",
);
$payload = json_encode($body);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Length:0',
'Content-Type:text/plain',
'Authorization: bearer ' . $access
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
print_r($result);
curl_close($ch);
Web.php
Route :: get('/ uploadFiles','AuthController @ uploadExcelWordFile')-> name('users.uploadfiles');