function _DIR($path) { $path = _DIR_CLEAR(rawurldecode($path)); $path = iconv_system($path); if (substr($path, 0, strlen(PUBLIC_PATH)) == PUBLIC_PATH) { return $path; } $path = HOME . $path; if (is_dir($path)) { $path .= '/'; } return $path; }
function _DIR($path, $pre_path = HOME) { $path = _DIR_CLEAR(rawurldecode($path)); $path = iconv_system($path); if (is_dir($path)) { $path .= '/'; } //公共目录处理 $share_len = strlen(PUBLIC_PATH); if (substr($path, 0, $share_len) == PUBLIC_PATH) { $pre_path = ''; //如果为共享目录 则不追加普通用户的目录前缀 } return $pre_path . $path; }
function _DIR($path) { $path = _DIR_CLEAR(rawurldecode($path)); $path = iconv_system($path); if (substr($path, 0, strlen('*recycle*/')) == '*recycle*/') { return USER_RECYCLE . str_replace('*recycle*/', '', $path); } if (substr($path, 0, strlen('*public*/')) == '*public*/') { return PUBLIC_PATH . str_replace('*public*/', '', $path); } if (substr($path, 0, strlen('*share*/')) == '*share*/') { return "*share*/"; } $path = HOME . $path; if (is_dir($path)) { $path = rtrim($path, '/') . '/'; } return $path; }
/** * 上传,html5拖拽 flash 多文件 */ public function fileUpload() { //show('error',false); $save_path = $this->path; if (!is_writeable($save_path)) { show_json($this->L['no_permission_write'], false); } if ($save_path == '') { show_json($this->L['upload_error_big'], false); } if (strlen($this->in['fullPath']) > 1) { //folder drag upload $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath'])); $full_path = get_path_father($full_path); $full_path = iconv_system($full_path); if (mk_dir($save_path . $full_path)) { $save_path = $save_path . $full_path; } } //upload('file',$save_path); //分片上传 $temp_dir = USER_TEMP; mk_dir($temp_dir); if (!is_writeable($temp_dir)) { show_json($this->L['no_permission_write'], false); } upload_chunk('file', $save_path, $temp_dir); }
private function zip($zip_path) { if (!isset($zip_path)) { show_json($this->L['share_not_download_tips'], false); } load_class('pclzip'); ini_set('memory_limit', '2028M'); //2G; $zip_list = json_decode($this->in['list'], true); $list_num = count($zip_list); for ($i = 0; $i < $list_num; $i++) { $zip_list[$i]['path'] = _DIR_CLEAR($this->path . $this->_clear($zip_list[$i]['path'])); } //指定目录 if ($list_num == 1) { $path_this_name = get_path_this($zip_list[0]['path']); } else { $path_this_name = get_path_this(get_path_father($zip_list[0]['path'])); } $zipname = $zip_path . $path_this_name . '.zip'; $zipname = get_filename_auto($zipname, date(' h.i.s')); $files = array(); for ($i = 0; $i < $list_num; $i++) { $files[] = $zip_list[$i]['path']; } $remove_path_pre = get_path_father($zip_list[0]['path']); $archive = new PclZip($zipname); $v_list = $archive->create(implode(',', $files), PCLZIP_OPT_REMOVE_PATH, $remove_path_pre); return iconv_app($zipname); }
/** * 上传,html5拖拽 flash 多文件 */ public function fileUpload() { $save_path = $this->path; if ($save_path == '') { show_json($this->L['upload_error_big'], false); } if (strlen($this->in['fullPath']) > 1) { //folder drag upload $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath'])); $full_path = get_path_father($full_path); $full_path = iconv_system($full_path); if (mk_dir($save_path . $full_path)) { $save_path = $save_path . $full_path; } } upload('file', $save_path); }