Esempio n. 1
0
    //覆盖原有文件
    $name = rawurldecode($_GET['name']);
    //文件名
    $post_input = 'php://input';
    if ($tpath) {
        //覆盖原有文件
        //获取文件内容
        $fileContent = '';
        $handle = fopen('php://input', 'r');
        while (!feof($handle)) {
            $fileContent .= fread($handle, 8192);
        }
        $icoarr = IO::setFileContent($tpath, $fileContent);
    } else {
        //新建文件
        $re = IO::uploadStream($post_input, $name, $path);
        //上传文件到服务器
        if (empty($re['error'])) {
            $icoarr = $re['icoarr'][0];
        } else {
            $icoarr = $re;
        }
    }
    echo json_encode($icoarr);
    //返回
    exit;
} else {
    $path = rawurldecode($_GET['path']);
    //根据文件路径打开文件
    if ($path) {
        $stream = $_G['siteurl'] . DZZSCRIPT . '?mod=io&op=thumbnail&width=1440&height=900&path=' . $path . '&original=1';