Commit c8405500 authored by 周智鹏's avatar 周智鹏

上传micro-api-flow专用上传文件的

parent 32696c91
...@@ -146,13 +146,13 @@ class UploadManager ...@@ -146,13 +146,13 @@ class UploadManager
// 文件重命名,由当前日期时间 + 唯一ID + 扩展名 // 文件重命名,由当前日期时间 + 唯一ID + 扩展名
$fileName = date('YmdHis') . uniqid() . '.' . $extension; $fileName = date('YmdHis') . uniqid() . '.' . $extension;
$name = $file->toArray()['name']; $name = $file->toArray()['name'];
$savePath = self::parsePath($options, $documentRoot) . $fileName.'_'.$name; $savePath = self::parsePath($options, $documentRoot) . $fileName;
$file->moveTo($savePath); $file->moveTo($savePath);
if ($file->isMoved()) { if ($file->isMoved()) {
if ($realPath) { if ($realPath) {
return $savePath; return $savePath.'?'.$name;
} else { } else {
return str_replace($documentRoot, '', $savePath); return str_replace($documentRoot, '', $savePath.'?'.$name);
} }
} else { } else {
throw new HttpResponseException('文件保存失败'); throw new HttpResponseException('文件保存失败');
......
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