700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > uedit 富文本编辑器 图片上传 图片服务器

uedit 富文本编辑器 图片上传 图片服务器

时间:2021-10-27 03:06:14

相关推荐

uedit 富文本编辑器 图片上传 图片服务器

uedit设置

修改uploader 类

源代码这个注释

$url = "/uploadImg.php";$tmpName = $file['name']; //上传上来的文件名$tmpFile = $file['tmp_name']; //上传上来的临时存储路径$tmpType = $file['type']; //上传上来的文件类型$folder = 'goods_uedit'; //存储路径//执行上传$data = json_decode($this->upload_file($url, $tmpName, $tmpFile, $tmpType, $folder));if($data->code){$this->fileName = $data->name;$t = time();$d = explode('-', date("Y-y-m-d-H-i-s"));$format = $this->config["pathFormat"];$format = str_replace("{yyyy}", $d[0], $format);$format = str_replace("{yy}", $d[1], $format);$format = str_replace("{mm}", $d[2], $format);$format = str_replace("{dd}", $d[3], $format);$format = str_replace("{hh}", $d[4], $format);$format = str_replace("{ii}", $d[5], $format);$format = str_replace("{ss}", $d[6], $format);$format = str_replace("{time}", $t, $format);$this->fullName =$format.$data->name;$this->stateInfo = 'SUCCESS';}

function upload_file($url,$filename,$path,$type, $folder){ //php 5.5以上的用法 if (class_exists('\CURLFile')) { $data = array('imgs' => new \CURLFile(realpath($path),$type,$filename),'folder' => $folder);} else { $data = array( 'imgs'=>'@'.realpath($path).";type=".$type.";filename=".$filename,'folder' => $folder); }$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $return_data = curl_exec($ch);$return_data = trim($return_data);curl_close($ch); return $return_data; }

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。