Commit b300fa5d authored by rlgy's avatar rlgy

update

parent 50643e9e
...@@ -37,15 +37,18 @@ class Uploader extends Component ...@@ -37,15 +37,18 @@ class Uploader extends Component
/** /**
* 上传文件 * 上传文件
* @param $uploaded_file UploadedFile * @param $uploaded_file UploadedFile
* @param $savename string 文件保存名 * @param $savename string 文件保存名
* @return bool|string 文件rui or false
* @throws Exception * @throws Exception
* @return bool|string 文件rui or false
*/ */
public function upload($uploaded_file, $savename = '') public function upload($uploaded_file, $savename = '')
{ {
if (empty($savename)) { if (empty($savename)) {
$savename = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension; $savename = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName);
if ($uploaded_file->extension) {
$savename = $savename . '.' . $uploaded_file->extension;
}
} }
$this->absolute = rtrim(str_replace('\\', '/', $this->absolute), '/') . '/'; $this->absolute = rtrim(str_replace('\\', '/', $this->absolute), '/') . '/';
...@@ -68,4 +71,4 @@ class Uploader extends Component ...@@ -68,4 +71,4 @@ class Uploader extends Component
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment