Commit 923b207b authored by hujun's avatar hujun

UploadFileService 文件上传 修改

parent ae335373
...@@ -26,7 +26,7 @@ class UploadFileService ...@@ -26,7 +26,7 @@ class UploadFileService
{ {
$check = $this->checkUploadFile($_upload_file, $size, $ext); $check = $this->checkUploadFile($_upload_file, $size, $ext);
if (isset($check['code']) || isset($check[0]['code'])) { if ($check['code'] == 101) {
return $check; return $check;
} }
...@@ -37,13 +37,13 @@ class UploadFileService ...@@ -37,13 +37,13 @@ class UploadFileService
$path = ROOT_PATH . 'public/'; $path = ROOT_PATH . 'public/';
switch ($type) { switch ($type) {
case 1 : case 'user_header' :
$path .= 'static/user_header/'; $path .= 'static/user_header/';
break; break;
case 2 : case 'agent_header' :
$path .= 'static/head_portrait/'; $path .= 'static/head_portrait/';
break; break;
case 3: case 'house_img':
$path .= 'resource/lib/Attachments/images/'; $path .= 'resource/lib/Attachments/images/';
default : default :
$path .= 'static/'; $path .= 'static/';
...@@ -105,14 +105,14 @@ class UploadFileService ...@@ -105,14 +105,14 @@ class UploadFileService
$file_info = pathinfo($_upload_file['name'][$k]); $file_info = pathinfo($_upload_file['name'][$k]);
if (filesize($v) > $size) { if (filesize($v) > $size) {
$data[0]['code'] = 101; $data['code'] = 101;
$data[0]['error'] = '文件太大无法上传'; $data['error'] = '文件太大无法上传';
break; break;
} }
if (!in_array($file_info['extension'], $ext)) { if (!in_array($file_info['extension'], $ext)) {
$data[0]['code'] = 101; $data['code'] = 101;
$data[0]['error'] = '文件类型不符无法上传'; $data['error'] = '文件类型不符无法上传';
break; break;
} }
......
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