I need help with this php code

Hi i am new here, i have to make something but i dont know what to do next can someone help me with this?

what i have to do is this:

scroll down for my problem :slight_smile:

hope you guys can help me

So, where should this value come from?

And why is the $id field protected?

  in my other file i have this  

include ‘batch.php’;
include ‘file.php’;

$id = uniqid();

$upload_files[] = [

        'square' => $destination . '/' . $_FILES['file']['name'][$i],
        'circle' => $locatie . '/' . topng ($_FILES['file']['name'][$i])
    ];
    print_r ($upload_files);



}

So, should you be returning back the path that the upload goes to?
Where that file is now?
I’m not understanding that. And Batch as the class doesn’t give a clear picture of what he class should be doing.

how can i solve this problem?

my code

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

class Batch
{
    protected $id;

    // De constructor
    public function __construct($id)
    {
        $this->id = $id;
        return $this;
    }

    public function getCircleFolder()
    {
        return "circles/$this->id/";
    }

    public function getSquareFolder()
    {
        return "squares/$this->id/";
    }

    public function ensureFoldersExist()
    {
        createDirectory($this->getCircleFolder());
        createDirectory($this->getSquareFolder());
        return null;
    }

    public function toZip()
    {
        $this->ensureFoldersExist();
        $obj_zip = new ZipArchive();
        $result = $obj_zip->open($this->getCircleFolder().$this->id.".zip", (ZipArchive::CREATE | ZipArchive::OVERWRITE));
        if ($result != TRUE) {
            //print('Failed with code %d', $result)
        } else {
           $arr_options = array('add_path' => $this->getCircleFolder(), 'remove_all_path' => TRUE);
            $obj_zip->addGlob('*.png', GLOB_BRACE, $arr_options);
            $obj_zip->close();
        }
    }
}
Sponsor our Newsletter | Privacy Policy | Terms of Service