Skip to content

增加 byte 流写入内容的考虑 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kraity opened this issue Aug 18, 2019 · 1 comment
Open

增加 byte 流写入内容的考虑 #4

kraity opened this issue Aug 18, 2019 · 1 comment

Comments

@kraity
Copy link

kraity commented Aug 18, 2019

增加 byte 流写入内容的考虑
用于XMLRPC接口上传附件因为XMLRPC上传用的byte流写入数据
108行

$filename = $file['tmp_name'];
       if (!isset($filename)) return false;

将其删掉

116行到127行

if ($error == null)   .... else return false; 

将其改为

if (isset($file['bytes'])) {
        	list($ret, $error) = $upManager->put($token, $option->savepath . $file['name'], $file['bytes']);
        	if ($error == null) {
        		return array(
        			'name' => $file['name'], 
        			'path' => $option->savepath . $file['name']  . ($option->imgstyle == '' ? '' : '-' . $option->imgstyle), 
        			'size' => $file['size'], 
        			'type' => $ext, 
        			'mime' => $file['mime']//Typecho_Common::mimeContentType($option->savepath . $file['name'])
        			);
        		
        	} else {
        		return false;
        	}
        	
        	
        } else {
	
	    // 上传文件
        $filename = $file['tmp_name'];
        //if (!isset($filename)) return false;
        list($ret, $error) = $upManager->putFile($token, $option->savepath . $file['name'], $filename);
           if ($error == null) {
        	return array(
        		'name' => $file['name'], 
        		'path' => $option->savepath . $file['name'] . ($option->imgstyle == '' ? '' : '-' . $option->imgstyle), 
        		'size' => $file['size'], 
        		'type' => $ext, 'mime' => Typecho_Common::mimeContentType($filename)
        		);
        		} else {
        	return false;
        
           }
        	
        }
@jzwalk
Copy link

jzwalk commented Jun 27, 2020

Typecho Fans社区版已代更

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants