本文整理匯總了PHP中Gallery::upload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::upload方法的具體用法?PHP Gallery::upload怎麽用?PHP Gallery::upload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::upload方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
function save($cat_id, $id = FALSE)
{
if ($_POST) {
$gallery = new Gallery($id);
if ($_FILES['image']['name']) {
if ($gallery->id) {
$gallery->delete_file($gallery->id, 'uploads/galleries/', 'image');
}
$_POST['image'] = $gallery->upload($_FILES['image'], 'uploads/galleries/');
$gallery->thumb('uploads/galleries/thumbs/', 170, 120);
}
$_POST['user_id'] = $this->session->userdata('id');
$gallery->from_array($_POST);
$gallery->save();
set_notify('success', lang('save_data_complete'));
}
redirect('galleries/admin/galleries/form/' . $cat_id);
}
示例2: save
function save($id = false)
{
if ($_POST) {
fix_file($_FILES['filesToUpload']);
foreach ($_FILES['filesToUpload'] as $key => $item) {
if ($item) {
$gallery = new Gallery();
if ($_FILES['filesToUpload'][$key]['name']) {
$gallery->image = $gallery->upload($_FILES['filesToUpload'][$key], 'uploads/gallery');
$gallery->category_id = $id;
$gallery->user_id = $this->session->userdata('id');
$gallery->save();
}
}
}
set_notify('success', lang('save_data_complete'));
}
redirect('galleries/admin/galleries/index/' . $_POST['category_id']);
}