From 8e75b3b605fa8dcff03713785af2736545c95be0 Mon Sep 17 00:00:00 2001 From: printempw Date: Wed, 14 Dec 2016 22:11:40 +0800 Subject: [PATCH] remove temp file if uploaded file duplicated --- app/Services/Utils.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Services/Utils.php b/app/Services/Utils.php index e8073119..530ca45b 100644 --- a/app/Services/Utils.php +++ b/app/Services/Utils.php @@ -31,6 +31,9 @@ class Utils if (!Storage::disk('textures')->has($hash)) { Storage::disk('textures')->move($path, $hash); + } else { + // delete the temp file + unlink($absolute_path); } return $hash;