优化文件上传

This commit is contained in:
liweisen 2020-11-24 13:53:34 +08:00
parent 114ba0d14d
commit bcb568f2a9
2 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@ use app\common\Model\Member;
use controller\BasicApi;
use service\FileService;
use think\Exception;
use think\facade\Log;
use think\facade\Request;
@ -116,11 +117,15 @@ class File extends BasicApi
$ext = explode('.', $orgFileName);
$ext = $ext[count($ext) - 1];
$fileUrl = "{$path}/{$fileName}-{$i}.{$ext}";
// logRecord(['url' => $fileUrl], 'info', 'temp/uploadFiles');
$site_url = FileService::getFileUrl($fileUrl, 'local');
if ($site_url) {
$blob = file_get_contents($site_url);
// $blob .= file_get_contents($site_url);
$fileList[] = env('root_path') . $fileUrl;
$result = FileService::$type($path2, $blob, true);
}
unset($blob);
unset($site_url);
unset($fileUrl);

View File

@ -49,7 +49,7 @@ return [
// Query类
'query' => '\\think\\db\\Query',
// 是否需要断线重连
'break_reconnect' => false,
'break_reconnect' => true,
// 断线标识字符串
'break_match_str' => [],
];