修复上传文件错误
This commit is contained in:
parent
944365827d
commit
497671c8ec
|
@ -26,14 +26,14 @@ class UploadController extends base
|
||||||
|
|
||||||
$now = date_create();
|
$now = date_create();
|
||||||
$savepath = sprintf("/uploads/%d/%s/%s", $request->admin->id, $now->format("YmdHisu"), $file->getUploadName());
|
$savepath = sprintf("/uploads/%d/%s/%s", $request->admin->id, $now->format("YmdHisu"), $file->getUploadName());
|
||||||
$file->move(public_path(). $savepath);
|
|
||||||
|
|
||||||
$item = new Uploads();
|
$item = new Uploads();
|
||||||
$item->admin_id = $request->admin->id;
|
$item->admin_id = $request->admin->id;
|
||||||
$item->filesize = $file->getSize();
|
$item->filesize = $file->getSize();
|
||||||
$item->filepath = $savepath;
|
$item->filepath = $savepath;
|
||||||
$item->mime = $file->getUploadMimeType();
|
$item->mime = $file->getUploadMimeType();
|
||||||
$item->create_at = $now->getTimestamp();
|
$item->create_at = $now->getTimestamp();
|
||||||
|
|
||||||
|
$file->move(public_path(). $savepath);
|
||||||
$item->save();
|
$item->save();
|
||||||
|
|
||||||
return $this->success($savepath);
|
return $this->success($savepath);
|
||||||
|
|
Loading…
Reference in New Issue