在通过表单上传并处理文件后,我正在尝试删除文件:
// FORM SUBMIT
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$uploadfile = getcwd() . '/pub/media/dealers/' . basename($_FILES['proof']['name']);
move_uploaded_file($_FILES['proof']['tmp_name'], $uploadfile);
// Upload attachment to Zendesk
$attachment = $client->attachments()->upload([
'file' => $uploadfile
]);
unlink($uploadfile);
exit;
}
我收到以下错误:
错误过滤模板:警告: 取消链接(C:.... \ MyFile.txt):资源 暂时不可用
如果我删除了$attachment
上传代码,则该文件将按预期删除。因此,我尝试了以下操作,但收到相同的“临时不可用”错误:
$attachment = $client->attachments()->upload([
'file' => $uploadfile
]);
unset($attachment);
unlink($uploadfile);
我想念什么吗?