當前位置: 首頁>>代碼示例>>PHP>>正文


PHP upload::upload_file方法代碼示例

本文整理匯總了PHP中upload::upload_file方法的典型用法代碼示例。如果您正苦於以下問題:PHP upload::upload_file方法的具體用法?PHP upload::upload_file怎麽用?PHP upload::upload_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在upload的用法示例。


在下文中一共展示了upload::upload_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

     // 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");
     }
開發者ID:BackupTheBerlios,項目名稱:core-svn,代碼行數:31,代碼來源:edit_note.php

示例2: upload

<?php 
include_once '../class/upload.class.php';
$upload = new upload();
echo $upload->upload_file();
開發者ID:joaosigno,項目名稱:dazake-job,代碼行數:4,代碼來源:upload.php


注:本文中的upload::upload_file方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。