Cpanel UAPI文件上传不起作用

时间:2018-08-03 07:51:50

标签: curl cpanel

我正在尝试使用Codeigniter中的cPanel UAPI Fileman upload_files将zip文件上传到cPanel。 Cpanel UAPI and API2 resource。 在下面给出的代码中,我已经为标志创建了一个cPanel对象。

Here is my code

$file = FCPATH.'assets/wordpress/wordpress.zip'; // path of the file

    if (function_exists('curl_file_create')) {
        $curl_file = curl_file_create($file);
    } else {
        $curl_file = "@/" . $file;
    }

    $upload_response = $cPanel->execute('uapi','Fileman','upload_files',
        array(  'dir'=> $data['response_documentroot'],
                'file-1'=>$curl_file
            ));

    print_r($upload_response);
}

我得到的回应是

estdClass Object (
[data] => stdClass Object (
    [failed] => 3
    [uploads] => Array (
        [0] => stdClass Object (
            [status] => 0
            [warnings] => Array ( )
            [reason] => The file “1[mime]” you tried to upload was not in the /tmp directory.
            [file] => 1[mime]
            [size] =>
        )
         [1] => stdClass Object (
            [status] => 0
            [reason] => The file “1[name]” you tried to upload was not in the /tmp directory.
            [warnings] => Array ( )
            [file] => 1[name]
            [size] =>
        )
        [2] => stdClass Object (
            [status] => 0
            [warnings] => Array ( )
            [reason] => The file “1[postname]” you tried to upload was not in the /tmp directory.
            [file] => 1[postname]
            [size] =>
        )
    )
    [warned] => 0
    [succeeded] => 0
)
[messages] =>
[metadata] => stdClass Object ( )
[status] => 0
[errors] => Array (
    [0] => Failed to upload any of the requested files with various failures.
)
[warnings] =>

0 个答案:

没有答案