本文整理汇总了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();