false, 'msg' => 'sign fail!', 'data' => array('file' => $_FILES, 'post' => $_POST))); die; } $filename = $_FILES['img']['name']; $tmpname = $_FILES['img']['tmp_name']; $imgUrl = $_POST['fileUrl'];//以/开始 $imgName = $_POST['fileName'];//文件名称 if (is_dir(dirname(__FILE__) . $imgUrl) == false) { echo json_encode(array('flag' => true, 'msg' => 'dir is not exit!', 'data' => array('file' => $_FILES, 'post' => $_POST))); } if (move_uploaded_file($tmpname, dirname(__FILE__) . $imgUrl . $imgName)) { echo json_encode(array('flag' => true, 'msg' => '', 'data' => array('file' => $_FILES, 'post' => $_POST))); svnCommit(dirname(__FILE__) . $imgUrl . $imgName); } else { echo json_encode(array('flag' => false, 'msg' => 'fail', 'data' => array('file' => $_FILES, 'post' => $_POST))); } } else { echo json_encode(array('flag' => false, 'msg' => 'unRequestFiles', 'data' => array('file' => $_FILES, 'post' => $_POST))); } /** * Des:上传文件更新到svn上 * Name: svnCommit * @param $file * @author 倪宗锋 */ function svnCommit($file) { $shell = "svn add {$file} --username=nizf --password=nizf --no-auth-cache"; @shell_exec($shell); $shell = "svn commit {$file} -m 'system' --username=nizf --password=nizf --no-auth-cache"; @shell_exec($shell); }