|
|
@@ -1884,13 +1884,7 @@ if (!function_exists('upload_image')) {
|
|
|
return message("文件格式不正确:" . $ext, false);
|
|
|
}
|
|
|
|
|
|
- // 文件路径
|
|
|
- $file_dir = ($file_path ? ATTACHMENT_PATH . '/images/' . $file_path : UPLOAD_TEMP_PATH) . "/" . date('Ymd');
|
|
|
|
|
|
- // 检测文件路径是否存在,不存在则创建
|
|
|
- if (!file_exists($file_dir)) {
|
|
|
- mkdir($file_dir, 0777, true);
|
|
|
- }
|
|
|
|
|
|
// 文件名称
|
|
|
$file_name = ($userId? $userId.'_'.str_replace('=','',base64_encode(date('YmdHis').$userId.$original_name)): str_replace('=','',base64_encode(date('YmdHis').$original_name)));
|
|
|
@@ -1898,12 +1892,24 @@ if (!function_exists('upload_image')) {
|
|
|
|
|
|
$driver = \App\Services\ConfigService::make()->getConfigByCode('file_upload_driver','local');
|
|
|
if($driver == 'qiniu'){
|
|
|
+ // 文件路径
|
|
|
+ $file_dir = ($file_path ? ATTACHMENT_PATH . '/images/' . $file_path : ATTACHMENT_PATH.'/images') . "/" . date('Ymd');
|
|
|
+
|
|
|
+
|
|
|
// 上传云
|
|
|
$file_path = str_replace(ATTACHMENT_PATH, '', $file_dir) . '/' . $file_name;
|
|
|
if(!$file_path = \App\Services\QiniuService::make()->upload($file_path, $file)){
|
|
|
return message(\App\Services\QiniuService::make()->getError(), false);
|
|
|
}
|
|
|
}else{
|
|
|
+ // 文件路径
|
|
|
+ $file_dir = ($file_path ? ATTACHMENT_PATH . '/images/' . $file_path : UPLOAD_TEMP_PATH) . "/" . date('Ymd');
|
|
|
+
|
|
|
+ // 检测文件路径是否存在,不存在则创建
|
|
|
+ if (!file_exists($file_dir)) {
|
|
|
+ mkdir($file_dir, 0777, true);
|
|
|
+ }
|
|
|
+
|
|
|
// 重命名保存
|
|
|
$path = $file->move($file_dir, $file_name);
|
|
|
// 文件临时路径
|