Undefined offset: 1

swtboy42

New Member
May 22, 2018
1
0
1
28
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!