Browse Source

不允许图片重复使用

master
wanghongjun 4 months ago
parent
commit
5c1e96b846
  1. 4
      app/common/controller/Upload.php

4
app/common/controller/Upload.php

@ -84,7 +84,7 @@ class Upload extends BaseController
$prefix=$filecate.'/'.date('Y-m-d').'/'.$uid."/";
}
$name=str_replace('.'.$info['ext'],'',$info['name']);
$file=FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
$file=false;//FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
// 判断文件是否存在,如果有则不再上传
if(!$file){
$newName = uniqid() . '.' . $info['ext'];
@ -327,7 +327,7 @@ class Upload extends BaseController
}
$prefix='emoji/'.$uid.'/';
$name=str_replace('.'.$info['ext'],'',$info['name']);
$fileInfo=FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
$fileInfo=false;//FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
// 判断文件是否存在,如果有则不再上传
if(!$fileInfo){
$newName = uniqid() . '.' . $info['ext'];

Loading…
Cancel
Save