public function entryedit() { $image = '/data0/www/html/gamebi/data/kindeditoruploaddir/image/20130715/20130715152611_21703.jpg'; $remote = 'assaddir/sss/sde'; //debug(UPLOAD_PATH); $ppath = $this->get_wximg_path($image); mod_ftp::uploadpath($image, $remote); debug($ppath); }
$ymd = date("Ymd"); $save_path .= $ymd . "/"; $save_url .= $ymd . "/"; if (!file_exists($save_path)) { mkdir($save_path); } //新文件名 $new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext; //移动文件 $file_path = $save_path . $new_file_name; if (move_uploaded_file($tmp_name, $file_path) === false) { alert("上传文件失败。"); } @chmod($file_path, 0644); $tagetdir = 'gamebi/' . $default . '/' . date("Y") . '/' . date("m") . '/' . date("d"); $ftppath = mod_ftp::uploadpath($file_path, $tagetdir); //debug($ftppath); if (empty($ftppath)) { alert("FTP上传文件失败。。。"); } $file_url = IMGURL_PREFIX . './' . $ftppath; header('Content-type: text/html; charset=UTF-8'); echo json_encode(array('error' => 0, 'url' => $file_url)); exit; } function alert($msg) { header('Content-type: text/html; charset=UTF-8'); echo json_encode(array('error' => 1, 'message' => $msg)); exit; }