Codeigniter 4 Product Multiple İmage Upload

I need to upload images before adding the product in my project, but I couldn’t get out of it. Since pictures will be added before the product is added, I do not know how to define the product number on the picture. I am waiting for your help in this regard.

Adding products and uploading images

$PostData = [
        'id'              => $this->request->getVar('id'),
        'name'            => $this->request->getVar('name'),
        'description'     => $this->request->getVar('description'),
        'options'         => $this->request->getVar('options'),
        'product_options' => $this->request->getVar('product_options'),
        'seo_tags'        => $this->request->getVar('seo_tags'),
        'price_purchase'  => $this->request->getVar('price_purchase'),
        'price'           => $this->request->getVar('price'),
        'price_discount'  => $this->request->getVar('price_discount'),
        'discount_date'   => $this->request->getVar('discount_date'),
        'tax_rate'        => $this->request->getVar('tax_rate'),
        'unit'            => $this->request->getVar('unit'),
        'free_shipping'   => $this->request->getVar('free_shipping'),
        'images'=>$this->request->getFileMultiple('files')
    ];

    if ($this->request->getFileMultiple('files')) {

        foreach($this->request->getFileMultiple('files') as $file)
        {   

           $file->move(WRITEPATH . 'uploads');

         $data = [
           'name' =>  $file->getClientName(),
           'type'  => $file->getClientMimeType()
         ];

         
        }
      
   }

   


    if ($id) {
        if (!$this->model->find($id)) {
            return $this->respond(['message' => "Ürün bulunamadı"], 400);
        }

        if (!$this->model->update($id, $PostData)) {
            return $this->respond(['message' => "Ürün güncellenirken hata oluştu lütfen sonra tekrar deneyin"], 400);
        }

        return $this->response->setStatusCode(200);
    }

    if (!$this->model->insert($PostData)) {
        return $this->respond(['message' => "Ürün güncellenirken hata oluştu lütfen sonra tekrar deneyin"], 400);
    }

    return $this->response->setStatusCode(200);