From 5a65c99e626d39305135522b62eef6dc38fe83d9 Mon Sep 17 00:00:00 2001 From: samayo Date: Sun, 5 May 2024 20:21:50 +0200 Subject: [PATCH] fix image name setter not workin #141 --- src/bulletproof.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bulletproof.php b/src/bulletproof.php index 3a82895..7da136e 100644 --- a/src/bulletproof.php +++ b/src/bulletproof.php @@ -401,8 +401,11 @@ public function setStorage($dir = 'uploads', $permission = 0666) */ protected function constraintValidator() { - // handle naming of file - $this->setName(); + + // if name is provided use it, otherwise generate a unique name + if (!$this->name) { + $this->setName(); + } /* check image for valid mime types and return mime */ $this->getImageMime($this->_files['tmp_name']);