Cpanel xmlapi FileUpload无法正常工作

时间:2015-12-16 08:37:26

标签: php cpanel-xmlapi xmlapi2

include '../xmlapi.php';

$ip = 'www.example.com';
$root_pass = 'abc';
$domain = "www.example.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("abc",$root_pass);
$xmlapi->set_http_client('curl');
$xmlapi->set_output('json');
$xmlapi->set_port(2083);
$xmlapi->set_debug(1); 

print $xmlapi->api2_query("user",'Fileman','uploadfiles',array('file-'=>'file1-public_html/subdomainuser/abc/sample.txt'));

当我用cpanel api的mkdir创建子域或创建目录时,此代码正常工作。但是当用于上传文件时,它总是显示相同的响应

{"cpanelresult":{"apiversion":2,"error":"You must specify at least one file to upload.","func":"uploadfiles","data":[{"uploads":[],"succeeded":0,"warned":0,"failed":0}],"event":{"result":1},"module":"Fileman"}}

任何人都可以通过cpanel xml-api帮助我完成上传过程吗?

1 个答案:

答案 0 :(得分:0)

include '../xmlapi.php';

$ip = 'www.example.com';
$root_pass = 'abc';
$domain = "www.example.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("abc",$root_pass);
$xmlapi->set_http_client('curl');`
`
$xmlapi->set_output('json');
$xmlapi->set_port(2083);
$xmlapi->set_debug(1); 

print $xmlapi->api2_query("user",'Fileman','uploadfiles',array('dir' => 'public_html', 'file-'=>'file1-sample.txt'))