예제 #1
0
     // wprowadzamy informacje o przynaleznych kategoriach
     foreach ($assign2cat as $selected_cat) {
         $query = sprintf("\r\n                        INSERT INTO \r\n                            %1\$s \r\n                        VALUES('', '%2\$d', '%3\$d')", TABLE_ASSIGN2CAT, $_GET['id'], $selected_cat);
         $db->query($query);
     }
     // usuwamy istniej±ce zdjêcie
     if (isset($_POST['delete_image']) && $_POST['delete_image'] == 1) {
         $query = sprintf("\r\n                        UPDATE \r\n                            %1\$s \r\n                        SET \r\n                            image = '' \r\n                        WHERE \r\n                            id = '%2\$d'", TABLE_MAIN, $_GET['id']);
         $db->query($query);
     }
     // dodajemy zdjêcie do wpisu
     if (!empty($_FILES['file']['name'])) {
         $up = new upload();
         $upload_dir = "../photos";
         // upload pliku na serwer.
         $file = $up->upload_file($upload_dir, 'file', true, true, 0, "jpg|jpeg|gif");
         if ($file == false) {
             echo $up->error;
         } else {
             $query = sprintf("\r\n                            UPDATE \r\n                                %1\$s \r\n                            SET \r\n                                image = '%2\$s' \r\n                            WHERE \r\n                                id = '%3\$d'", TABLE_MAIN, $file, $_GET['id']);
             $db->query($query);
         }
     }
     $ft->assign('CONFIRM', $i18n['edit_note'][0]);
     $ft->parse('ROWS', ".result_note");
 } else {
     $monit[] = $i18n['edit_note'][3];
     foreach ($monit as $error) {
         $ft->assign('ERROR_MONIT', $error);
         $ft->parse('ROWS', ".error_row");
     }
예제 #2
0
<?php 
include_once '../class/upload.class.php';
$upload = new upload();
echo $upload->upload_file();