优化上传组件,修复一处bug
This commit is contained in:
@@ -61,11 +61,11 @@ class Upload extends Base {
|
||||
'query' => $this->request->param()
|
||||
];
|
||||
if($param['type'] == 'file'){
|
||||
$map[] = ['ext', '<>', 'image'];
|
||||
$map[] = ['type', '<>', 'image'];
|
||||
}else{
|
||||
$map[] = ['ext', '=', 'image'];
|
||||
$map[] = ['type', '=', 'image'];
|
||||
}
|
||||
$list = Db::name('Attach')->paginate($pageConfig);
|
||||
$list = Db::where($map)->name('Attach')->paginate($pageConfig);
|
||||
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
@@ -141,6 +141,8 @@ class Upload extends Base {
|
||||
$data = [];
|
||||
$file= $request->file('file');
|
||||
$data['savename'] = $request->param('name');
|
||||
$data['name'] = $request->param('name');
|
||||
$data['type'] = $upload_type;
|
||||
$data['mime'] = $request->param('type');
|
||||
$data['size'] = $file->getSize(); //文件大小,单位字节
|
||||
$data['md5'] = md5_file($file->getPathname());
|
||||
|
||||
Reference in New Issue
Block a user