uedit设置
修改uploader 类
源代码这个注释
$url = "upimg.com/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; }