Merhaba php konusunda yeniyim kodlama bilgim yok bu yüzden kodlarımı paylaşıp sizden bana tarif etmenizi eklemem gereken kodlarda yardımcı olmanızı talep ediyorum.

Kısaca: Admin panelim var ve ürün ekleme sayfam var. Bu ürün ekleme sayfasına ürün resmi butonu ile ürün resmi yüklemek istiyorum. Bu konu hakkında yönlendirmelerinizi bekliyorum.

admin panelinde urun-ekle.php adında bir sayfam var. Buraya bir buton koyup ürüne resim ekleme işlemi yapmak istiyorum.



urun-ekle.php sayfasının kodları;

<?php include 'header.php'; ?>

        <!-- Begin Page Content -->
        <div class="container-fluid">

          <!-- Page Heading -->
          <h1 class="h3 mb-4 text-gray-800">Ürün Ekle</h1>
          <script type="text/javascript">
              

          </script>
          <form class="user" action="confile/transactions.php" method="post" enctype="multipart/form-data" >
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label">Kategori</label>
                                    <div class="col-sm-4">
                                        <!-- <input type="text" class="form-control form-control-user" name="op_menu_name" > -->

                                        <select required class="custom-select" name="urun_tur">
                                            <?php
                                              $stook = $db->query("SELECT * FROM kategori ", PDO::FETCH_ASSOC);
                                              if ( $stook->rowCount() ){
                                                foreach( $stook as $row ){
                                                  ?>
                                                  <option value="<?php echo $row['ad']; ?>"><?php echo $row['ad']; ?></option>
                                                  <?php
                                                }} ?>
                                            
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label">Ürün Adı</label>
                                    <div class="col-sm-4">
                                        <input type="text" placeholder="Örn: Latte" required class="form-control form-control-user" name="urun_ad" >
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label">Detay</label>
                                    <div class="col-sm-4">
                                        <textarea id="detay" placeholder="Örn: Double Espresso , Süt" required name="urun_detay"  class="form-control here"></textarea>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label">Fiyat</label>
                                    <div class="col-sm-4">
                                        <input type="text" placeholder="Örn: 55" onkeypress='return event.charCode >= 48 && event.charCode <= 57' required class="form-control form-control-user" name="urun_fiyat" >
                                    </div>
                                </div>
                            



                                <button class="btn btn-success btn-icon-split" name="urun_ekle" type="submit"><span class="icon text-white-50">
                                    <i class="fas fa-check"></i>
                                </span>
                                <span class="text">Kaydet</span></button>
                            </form>

        </div>
        <!-- /.container-fluid -->
<?php
include 'footer.php';
 ?>


Bu işlemlerin döndüğü sayfa sanırım confile/transactions.php adındaki dosya oluyor.
confile/transactions.php kodları;


<?php


ob_start();
session_start();
include 'connect.php';
if (isset($_POST['loggin'])) {


  $admin_kadi = htmlspecialchars($_POST['username']);
  $admin_sifre  = md5(htmlspecialchars($_POST['password']));
  if (empty($admin_kadi) || empty($admin_sifre)) {
    header("Location:../login.php?durum=null");
  }
  else{

    $varmi = $db->prepare("SELECT * from yonetim where username=? && password=? ");
    $varmi->execute(array(
      $admin_kadi,
      $admin_sifre
    ));

    if($varmi->rowCount()>0)
    {
      $dizi = $varmi->fetch(PDO::FETCH_ASSOC);
      $_SESSION["num"] = $dizi["username"];
      $_SESSION["start_time"] = time();
      header("Location: ../index.php?durum=basarili");
      exit;


    }              
    else{
      header("Location:../login.php?durum=no");
      exit;
    }
  }
}

if (isset($_POST['user-update'])) {
  $query = $db->prepare("SELECT * FROM yonetim WHERE id=?");
  $query->execute(array(1));
  $ayarcek = $query->fetch();  
  $admin_kadi = htmlspecialchars(trim($_POST['username']));
  if ($_POST["old-pass"] && $_POST["new-pass"] > 0 ) {
    $oldpass= md5($_POST["old-pass"]);
    $paswords= md5(htmlspecialchars($_POST["new-pass"]));
    if ($oldpass==$ayarcek["password"]) {
      $sil=$db->prepare("UPDATE yonetim SET username=:username, password=:password where id=:pimg_id");
      $kontrol=$sil->execute(array(
        'username' => $admin_kadi,
        'password' => $paswords,
        'pimg_id' => 1
      ));
      if ($kontrol) {
        $_SESSION["num"] = $_POST["username"];
        Header("Location:../user.php?durum=okk");

      } else {

        Header("Location:../user.php?durum=noo");
      }
    }else{
      echo "hatalı şifre";
    }
    
  }else{
    $sil=$db->prepare("UPDATE yonetim SET username=:username where id=:pimg_id");
    $kontrol=$sil->execute(array(
      'username' => $admin_kadi,
      'pimg_id' => 1
    ));
    if ($kontrol) {
      $_SESSION["num"] = $_POST["username"];
      Header("Location:../user.php?durum=ok");

    } else {

      Header("Location:../user.php?durum=no");
    }
  }
}
//----------------------------urun ekle-------------------------------

if (isset($_POST['urun_ekle'])) {

                    $ayarkaydet=$db->prepare("INSERT INTO urun SET
                      tur=:urunid,
                      baslik=:urun_ad,
                      detay=:urun_detay,
                      fiyat=:urun_fiyat
                      ");

                    $update=$ayarkaydet->execute(array(
                      'urunid' => $_POST['urun_tur'],
                      'urun_ad' => $_POST['urun_ad'],
                      'urun_detay' => $_POST['urun_detay'],
                      'urun_fiyat' => $_POST['urun_fiyat']
                    ));


                    if ($update) {

                      header("Location:../urun.php?durum=ok");

                    }else {

                      header("Location:../urun.php?durum=no");
                    }
              }
              
              
//----------------------------ürün resmi ekle-------------------------------

//----------------------------urun duzenle-------------------------------



              if (isset($_POST['urun_duzenle'])) {


                      $ayarkaydet=$db->prepare("UPDATE urun SET
                        tur=:uruntur,
                        baslik=:urun_ad,
                        detay=:urun_detay,
                        fiyat=:urun_fiyat
                        WHERE id=:id");

                      $update=$ayarkaydet->execute(array(
                        'uruntur' => $_POST['urun_tur'],
                        'urun_ad' => $_POST['urun_ad'],
                        'urun_detay' => $_POST['urun_detay'],
                        'urun_fiyat' => $_POST['urun_fiyat'],
                        'id' => $_POST["urunid"]
                      ));


                      if ($update) {

                        header("Location:../urun_duzenle.php?durum=ok&urun=".$_POST["urunid"]);

                      }else {

                        header("Location:../urun_duzenle.php?durum=no&urun=".$_POST["urunid"]);
                      }

                    

                  }


//----------------------------kategori ekle-------------------------------
                  if (isset($_POST['kategori_ekle'])) {

                    $ayarkaydet=$db->prepare("INSERT INTO kategori SET
                      ad=:katad,
                      sira=:katsira
                      ");

                    $update=$ayarkaydet->execute(array(
                      'katad' => $_POST['kategori_ad'],
                      'katsira' => $_POST['kategori_sira']
                      
                    ));


                    if ($update) {

                      Header("location:../kategoriler.php?durum=ok");

                    }else {

                      Header("location:../kategoriler.php?durum=no");
                    }
              }

              
//----------------------------kategori duzenle-------------------------------
              if (isset($_POST['kategori_duzenle'])) {

                $kaydet=$db->prepare(" UPDATE kategori SET
                  ad=:katad,
                  sira=:katsira

                  WHERE id=:urunid");

                $update=$kaydet->execute(array(
                  'katad' => $_POST['kategori_ad'],
                  'katsira' => $_POST['kategori_sira'],
                  'urunid' => $_POST['id']

                ));


                if ($update) {

                  Header("location:../kategoriler.php?durum=uok&urun_id=$urun_id");

                }else {

                  Header("location:../kategoriler.php?durum=uno&urun_id=$urun_id");
                }

              

            }



//----------------------------site ayar -------------------------------
            if (isset($_POST['siteayarkaydet'])) {
              $id=0;
              $uzantim="../../";
              if ($_FILES["resim_url"]["size"]>0){
                if ($_FILES["resim_url"]["size"]<5024*5024){//Dosya boyutu 1Mb tan az olsun

                        if ($_FILES["resim_url"]["type"]=="image/png"){  //dosya tipi jpeg olsun


                          $dosya_adi   =    $_FILES["resim_url"]["name"];

                            //Resimi kayıt ederken yeni bir isim oluşturalım
                          $uret=array("as","rt","ty","yu","fg");
                          $uzanti=substr($dosya_adi,-4,4);
                          $sayi_tut=rand(1,10000);

                          $yeni_ad="img/".$uret[rand(0,4)].$sayi_tut.$uzanti;

                            //Dosya yeni adıyla uploadklasorune kaydedilecek

                          if (move_uploaded_file($_FILES["resim_url"]["tmp_name"],$uzantim.$yeni_ad)){
                            echo 'Dosya başarıyla yüklendi.';
                            $bul = $db->prepare("SELECT * from siteayar where id=?");
                            $bul->execute(array(1));
                            $v = $bul->fetch();

                            unlink($uzantim.$v["logo"]);
                                //Bilgileri veritabanına kayıt ediyoruz..

                            $ayarkaydet=$db->prepare("UPDATE siteayar SET
                              logo=:op_logo,
                              telefon=:telefon,
                              mail=:mail,
                              twitter=:twitter,
                              facebook=:facebook,
                              linkedin=:linkedin,
                              copyright=:copyright
                              WHERE id=:op_id");

                            $update=$ayarkaydet->execute(array(
                              'op_id' => 1,
                              'op_logo' => $yeni_ad,
                              'telefon' => $_POST['telefon'],
                              'mail' => $_POST['mail'],
                              'twitter' => $_POST['twitter'],
                              'facebook' => $_POST['facebook'],
                              'linkedin' => $_POST['linkedin'],
                              'copyright' => $_POST['copyright']
                            ));


                            if ($update) {

                              header("Location:../ayar.php?durum=ok");

                            }else {

                              header("Location:../ayar.php?durum=no");
                            }

                          }else{
                            header("Location:../ayar.php?durum=yuklenemedi");
                          }
                        }else{
                          header("Location:../ayar.php?durum=jpeg");
                        }
                      }else{          
                        header("Location:../ayar.php?durum=boyut");
                      }
                    }
                    else{

                      $ayarkaydet=$db->prepare("UPDATE siteayar SET
                        telefon=:telefon,
                        mail=:mail,
                        twitter=:twitter,
                        facebook=:facebook,
                        linkedin=:linkedin,
                        copyright=:copyright
                        WHERE id=1");

                      $update=$ayarkaydet->execute(array(
                        'telefon' => $_POST['telefon'],
                        'mail' => $_POST['mail'],
                        'twitter' => $_POST['twitter'],
                        'facebook' => $_POST['facebook'],
                        'linkedin' => $_POST['linkedin'],
                        'copyright' => $_POST['copyright']
                      ));


                      if ($update) {

                        header("Location:../ayar.php?durum=ok");

                      }else {

                        header("Location:../ayar.php?durum=no");
                      }

                    }

                  }




//----------------------------urun sil onaylı------------------------------
              if(isset($_POST['urun_sil'])) {
               deleteConfirmed($_POST['urunid']);
             }
             function deleteConfirmed($icerik_id){
              global $db;
                $sil=$db->prepare("DELETE from urun where id=:pimg_id");
                $kontrol=$sil->execute(array(
                  'pimg_id' => $icerik_id
                ));



                if ($kontrol) {

                  Header("Location:../urun.php?icerik_id=$icerik_id&durum=silok");


                } else {

                  Header("Location:../urun.php?icerik_id=$icerik_id&durum=silno");
                }
              }

//----------------------------kategori sil onaylı------------------------------

            

            if(isset($_POST['kategori_sil'])) {
             deleteConfirmedd($_POST['id']);
           }
           function deleteConfirmedd($icerik_id){
            global $db;
                    // Delete the entry

            $bul = $db->prepare("SELECT * from kategori where id=?");
            $bul->execute(array($icerik_id));
            $v = $bul->fetch();

            $bull = $db->prepare("SELECT * from urun where tur=?");
            $bull->execute(array($v["ad"]));
            $v2 = $bull->fetch();
            if($v2["tur"]==$v["ad"]) {
             Header("Location:../kategoriler.php?durum=icerikvar");
           }else{
             $sil=$db->prepare("DELETE from kategori where id=:pimg_id");
             $kontrol=$sil->execute(array(
              'pimg_id' => $icerik_id
            ));

             if ($kontrol) {

              Header("Location:../kategoriler.php?icerik_id=$icerik_id&durum=silok");


            } else {

              Header("Location:../kategoriler.php?icerik_id=$icerik_id&durum=silno");
            }
          }



        }



urun-ekle.php sayfasında ürüne ait resim ekleyip uploads adlı klasöre yükletmek istiyorum. Bunu nasıl yapabilriim?

Veritabanında ise urun_resim adında bir sutun oluşturdum.