修复上传文件错误

This commit is contained in:
liuyuhang 2024-07-09 16:32:28 +08:00
parent 944365827d
commit 497671c8ec
1 changed files with 2 additions and 2 deletions

View File

@ -26,14 +26,14 @@ class UploadController extends base
$now = date_create();
$savepath = sprintf("/uploads/%d/%s/%s", $request->admin->id, $now->format("YmdHisu"), $file->getUploadName());
$file->move(public_path(). $savepath);
$item = new Uploads();
$item->admin_id = $request->admin->id;
$item->filesize = $file->getSize();
$item->filepath = $savepath;
$item->mime = $file->getUploadMimeType();
$item->create_at = $now->getTimestamp();
$file->move(public_path(). $savepath);
$item->save();
return $this->success($savepath);