Cpanel xmlapi FileUpload not working properly

3.3k views Asked by At
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'));

This code works properly when I use to create subdomain or create directory through mkdir of cpanel api 2.But when using to upload files it always shows the same response

{"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"}}

Can any one help me to complete upload process through cpanel xml-api?

1

There are 1 answers

1
sahil gill On
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'))