Undefined offset: 1

swtboy42

New Member
May 22, 2018
1
0
1
29
Hello, I'm trying to upload an iso image to proxmox server via web api using
CpuID/pve2-api-php-client

but it seems it's always error in "Undefined offset:1"

any solution for it?

this is my code

PHP:
  include (app_path().'/pve2-api-php-client/pve2_api.class.php');

        $pve2 = new \PVE2_API('hostname','username','realm','password');
        if ($pve2->login()) {

            # Get first node name.
            $nodes = $pve2->get_node_list();
            $first_node = $nodes[0];
            unset($nodes);

            $data_storage = DataStorage::find($id);
            $filename = $data_storage->filename;
            $storage = "local";

           $new_storage =  array();
           $new_storage["content"] = "iso";
           $new_storage["filename"] = $filename;
           $new_storage["node"] = $first_node;
           $new_storage["storage"]= $storage;

            return $pve2->post("/nodes/".$first_node."/storage/".$storage."/upload", $new_storage);
            print("\n\n");
        } else {
            print("Login to Proxmox Host failed.\n");
            exit;
        }

i'm using php language with Laravel Frame work

thank you very much