From 2af19639cb7d788fa21db7ee14ef95c8ca0ef7d1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 18 May 2016 15:43:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BFile=E7=B1=BB=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=97=AD=E5=8C=85=E8=A7=84=E5=88=99=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=BA=E5=BD=93=E5=89=8D=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/File.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/File.php b/library/think/File.php index 3678321d..c772d8c7 100644 --- a/library/think/File.php +++ b/library/think/File.php @@ -120,18 +120,18 @@ class File extends SplFileObject if (true === $savename) { // 自动生成文件名 if ($this->rule instanceof \Closure) { - $savename = call_user_func_array($this->rule, [$this->getFilename()]); + $savename = call_user_func_array($this->rule, [$this]); } else { switch ($this->rule) { case 'uniqid': $savename = uniqid(); break; case 'md5': - $md5 = md5_file($this->getFilename()); + $md5 = md5_file($this->getRealPath()); $savename = substr($md5, 0, 2) . DS . substr($md5, 2); break; case 'sha1': - $sha1 = sha1_file($this->getFilename()); + $sha1 = sha1_file($this->getRealPath()); $savename = substr($sha1, 0, 2) . DS . substr($sha1, 2); break; case 'date':