<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Traits;trait Upload{public function uploadImg($request,$key){$file=$request->file($key);$data=$request->all();$P2gAC0=array();$P2gAC0[$key]='max:10240';$rules=$P2gAC0;$P2gAC0=array();$P2gAC0[$key.".max"]='文件过大,文件大小不得超出10MB';$messages=$P2gAC0;$validator=Validator($data,$rules,$messages);$P2g0=!$validator->fails();if($P2g0)goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:$P2gAC0=array();$P2gAC0[]="png";$P2gAC0[]="jpg";$P2gAC0[]="gif";$P2gAC0[]="jpeg";$allowed_extensions=$P2gAC0;$P2g1=(bool)$file->getClientOriginalExtension();if($P2g1)goto P2gBodyx5;goto P2gNextx5;P2gBodyx5:$P2g0=!in_array($file->getClientOriginalExtension(),$allowed_extensions);$P2g1=(bool)$P2g0;goto P2gx4;P2gNextx5:P2gx4:if($P2g1)goto P2gBodyx6;goto P2gNextx6;P2gBodyx6:$P2gAC0=array();$P2gAC0['error']='You may only upload png, jpg or gif.';return $P2gAC0;goto P2gx3;P2gNextx6:P2gx3:$P2g0=storage_path('app/') . '/upload/image/';$A____AAAA="date";$P2gAC1=$A____AAAA('Y',time());$P2g1=$P2g0 . $P2gAC1;$P2g2=$P2g1 . '/';$A___A____="date";$P2gAC2=$A___A____('m',time());$P2g3=$P2g2 . $P2gAC2;$P2g4=$P2g3 . '/';$A___A___A="date";$P2gAC3=$A___A___A('d',time());$P2g5=$P2g4 . $P2gAC3;$P2g6=$P2g5 . '/';$destinationPath=$P2g6;$extension=$file->getClientOriginalExtension();$this->makeDirs($destinationPath);$A___A__A_="time";$P2gAC0=$A___A__A_();$A___A__AA="rand";$P2gAC1=$A___A__AA(1000,9999);$P2g0=$P2gAC0 . $P2gAC1;$P2g1=$P2g0 . '.';$P2g2=$P2g1 . $extension;$fileName=$P2g2;$file->move($destinationPath,$fileName);$A___A_A__="substr";$P2gAC0=$A___A_A__($destinationPath . $fileName,strpos($destinationPath . $fileName,'upload'));$res=$P2gAC0;goto P2gx1;P2gNextx2:$res=2;P2gx1:return $res;}public function makeDirs($dir){$A___A_A_A="is_dir";$P2gAC0=$A___A_A_A($dir);$P2g0=!$P2gAC0;if($P2g0)goto P2gBodyx8;goto P2gNextx8;P2gBodyx8:$P2g0=!$this->makeDirs(dirname($dir));if($P2g0)goto P2gBodyxa;goto P2gNextxa;P2gBodyxa:return false;goto P2gx9;P2gNextxa:P2gx9:$A___A_AA_="mkdir";$P2gAC0=$A___A_AA_($dir,0777);$P2g0=!$P2gAC0;if($P2g0)goto P2gBodyxc;goto P2gNextxc;P2gBodyxc:return false;goto P2gxb;P2gNextxc:P2gxb:goto P2gx7;P2gNextx8:P2gx7:return true;}public function commonImg($request){$file=$request->file('file');$data=$request->all();$P2gAC0=array();$P2gAC0["file"]='max:5120';$rules=$P2gAC0;$P2gAC0=array();$P2gAC0["file.max"]='文件过大,文件大小不得超出5MB';$messages=$P2gAC0;$validator=Validator($data,$rules,$messages);$P2g0=!$validator->fails();if($P2g0)goto P2gBodyxe;goto P2gNextxe;P2gBodyxe:$P2gAC0=array();$P2gAC0[]="png";$P2gAC0[]="jpg";$P2gAC0[]="gif";$P2gAC0[]="jpeg";$allowed_extensions=$P2gAC0;$P2g1=(bool)$file->getClientOriginalExtension();if($P2g1)goto P2gBodyxh;goto P2gNextxh;P2gBodyxh:$P2g0=!in_array($file->getClientOriginalExtension(),$allowed_extensions);$P2g1=(bool)$P2g0;goto P2gxg;P2gNextxh:P2gxg:if($P2g1)goto P2gBodyxi;goto P2gNextxi;P2gBodyxi:$P2gAC0=array();$P2gAC0['error']='You may only upload png, jpg or gif.';return $P2gAC0;goto P2gxf;P2gNextxi:P2gxf:$P2g0=storage_path('app/') . '/upload/image/';$A___A_AAA="date";$P2gAC1=$A___A_AAA('Y',time());$P2g1=$P2g0 . $P2gAC1;$P2g2=$P2g1 . '/';$A___AA___="date";$P2gAC2=$A___AA___('m',time());$P2g3=$P2g2 . $P2gAC2;$P2g4=$P2g3 . '/';$A___AA__A="date";$P2gAC3=$A___AA__A('d',time());$P2g5=$P2g4 . $P2gAC3;$P2g6=$P2g5 . '/';$destinationPath=$P2g6;$extension=$file->getClientOriginalExtension();$this->makeDirs($destinationPath);$A___AA_A_="time";$P2gAC0=$A___AA_A_();$A___AA_AA="rand";$P2gAC1=$A___AA_AA(1000,9999);$P2g0=$P2gAC0 . $P2gAC1;$P2g1=$P2g0 . '.';$P2g2=$P2g1 . $extension;$fileName=$P2g2;$file->move($destinationPath,$fileName);$A___AAA__="substr";$P2gAC0=$A___AAA__($destinationPath . $fileName,strpos($destinationPath . $fileName,'upload'));$res=$P2gAC0;goto P2gxd;P2gNextxe:$res=2;P2gxd:return $res;}}
?>