本文整理匯總了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");
}
示例2: upload
<?php
include_once '../class/upload.class.php';
$upload = new upload();
echo $upload->upload_file();