public function upload(){
$uid=1;
$basema=I('basema');
$type=I('type');
$imgData=str_replace(' ','',$basema);
$s=base64_decode(str_replace('data:'.$type.';base64,','',$imgData));
$path=$_SERVER['DOCUMENT_ROOT'].'/Public/images/'.date('Ymd',time()).'/';
if(!is_dir($path)){
if(mkdir($path)){
}else{
exit('1');
}
}
if($type=='image/gif'){
file_put_contents($path.$uid.time().'.gif', $s);
$xx='/Public/images/'.date('Ymd',time()).'/'.$uid.time().'.gif';
}else{
file_put_contents($path.$uid.time().'.jpg', $s);
$xx='/Public/images/'.date('Ymd',time()).'/'.$uid.time().'.jpg';
}
echo $xx;
}
$uid=1;
$basema=I('basema');
$type=I('type');
$imgData=str_replace(' ','',$basema);
$s=base64_decode(str_replace('data:'.$type.';base64,','',$imgData));
$path=$_SERVER['DOCUMENT_ROOT'].'/Public/images/'.date('Ymd',time()).'/';
if(!is_dir($path)){
if(mkdir($path)){
}else{
exit('1');
}
}
if($type=='image/gif'){
file_put_contents($path.$uid.time().'.gif', $s);
$xx='/Public/images/'.date('Ymd',time()).'/'.$uid.time().'.gif';
}else{
file_put_contents($path.$uid.time().'.jpg', $s);
$xx='/Public/images/'.date('Ymd',time()).'/'.$uid.time().'.jpg';
}
echo $xx;
}