本文整理汇总了PHP中Upload::files方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::files方法的具体用法?PHP Upload::files怎么用?PHP Upload::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Upload
的用法示例。
在下文中一共展示了Upload::files方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($video as $video_tmp) {
$array_video = array("id_lessons" => $id_lessons, "src" => $video_tmp);
DB::insert(DB::insertSql("video", $array_video), $array_video);
}
}
if ($_POST['go'] == "save") {
$array_homework = array("id_lessons" => $id_lessons, "text" => $_POST['text']);
$id_homework = DB::insert(DB::insertSql("homework", $array_homework), $array_homework);
} else {
$id_lessons = $_POST["go"];
$id_homework_tmp = DB::selectParam("homework", "id_lessons", $id_lessons, false, false);
$id_homework = $id_homework_tmp[0]['id'];
$array_homework = array("text" => $_POST['text']);
DB::update(DB::updateSql("homework", $array_homework), $array_homework, $id_homework);
}
$homework_materials = Upload::files($_FILES["homework_materials"], "homework");
if ($homework_materials) {
foreach ($homework_materials as $homework_materials_src_tmp) {
$array_homework = array("id_homework" => $id_homework, "src" => $homework_materials_src_tmp);
DB::insert(DB::insertSql("homework_materials", $array_homework), $array_homework);
}
}
header("Location: lessons.php?id=" . $_POST["kurs"]);
}
if (isset($_GET["edit"])) {
if (isset($_GET["delete"])) {
Delete::del($_GET["title"], $_GET["delete"]);
header("Location: add_lessons.php?edit=" . $_GET["edit"]);
}
$lesson_records = DB::selectID("lessons", $_GET["edit"]);
$material_records = DB::selectParam("materials", "id_lessons", $_GET["edit"], false, false);
示例2: mysql_num_rows
$field_list = '*';
$condition = "email='" . $_POST['txtemail_id'] . "' and register_id='" . $_POST['reg_id'] . "' and type='tr'";
$res = Model::view($tablename, $condition, $field_list);
$total = mysql_num_rows($res);
if ($total != 0) {
if (isset($_POST['check1'])) {
$course = implode(',', $_POST['check1']);
}
if (isset($_POST['check1'])) {
$course1 = implode(',', $_POST['check2']);
}
//upload resume
$field = 'upload_resume';
$dest = '../trainer/upload_resume';
$start_name = $_POST['reg_id'];
$resume = Upload::files($field, $dest, $start_name);
//upload image
$field = 'upload_photo';
$dest = '../trainer/upload_photo';
$image = Upload::image($field, $dest, $start_name);
$set_value = "name='" . $_POST['txttrainer'] . "', qualification='" . $_POST['qualification'] . "', date_of_birth='" . $_POST['year'] . "/" . $_POST['month'] . "/" . $_POST['day'] . "', address='" . $_POST['txtaddress'] . "', email='" . $_POST['txtemail_id'] . "', image='{$image}', resume='{$resume}', course_type='{$course1}', course_level='{$course}', contact_no='" . $_POST['txtcontact_no'] . "', exprience='" . $_POST['txtexp'] . "', password='{$ranStr}'";
$condition = "register_id='" . $_POST['reg_id'] . "'";
$r = Model::update($tablename, $set_value, $condition);
if ($r) {
$email = $_POST['txtemail_id'];
$message = "Your Registration Succesfully Done ! Your Email ID-:" . $email . " and Password-:" . $ranStr;
$subject = "Registration";
$mail = new Mail($subject, $message, $email);
$a = $mail->sendMail();
if ($a) {
header("Location:../Main Content/welcome_message.php?title=registration");
示例3: foreach
foreach ($user_answer1 as $key => $ans) {
$u_s = explode('_', $ans);
$tablename = 'test_paper';
$field = "currect_ans";
$condition = "session_id='" . $_POST['session_id'] . "' and question_no='" . $u_s[0] . "'";
$r = Model::view($tablename, $condition, $field);
$s = mysql_fetch_array($r);
if ($s['currect_ans'] == $u_s[1]) {
$i++;
}
}
$tablename = 'apear_test';
$set_value = "session_id='" . $_POST['session_id'] . "', batch_id='" . $_POST['batch_id'] . "', student_id='" . $_POST['student_id'] . "', user_answer='{$user_answer}', marks_to_ten='{$i}', currect_answer='{$cr_answer}'";
$r = Model::save($tablename, $set_value);
}
}
if (isset($_POST['submit_assignment'])) {
//upload resume
$field = 'assignment';
$dest = 'upload_assignment';
$start_name = $email;
$assg = Upload::files($field, $dest, $start_name);
if ($assg != '') {
$table = 'apear_test';
$set_value = "assignment='{$assg}'";
$condition = "session_id='" . $_POST['session_id'] . "' and student_id='{$email}'";
$result = Model::update($table, $set_value, $condition);
}
header('location:session_detail.php');
}
header('location:student panel.php');
示例4: array
<?php
include "models/function.php";
$lesson = $_SESSION['lessons'];
$id = $_GET['id'];
$less = DB::selectID("lessons", $id);
$video = DB::selectParam("video", "id_lessons", $id);
if (isset($_POST['go'])) {
$array = array("id_lessons" => $lesson, "id_clients" => $_SESSION['user_id'], "text" => $_POST['text']);
$lastId = DB::insert(DB::insertSql("answer", $array), $array);
$materials = Upload::files($_FILES["answer_materials"], "answer_materials");
if ($materials) {
foreach ($materials as $materials_src_tmp) {
$array_materials = array("id_answer" => $lastId, "src" => $materials_src_tmp);
DB::insert(DB::insertSql("answer_materials", $array_materials), $array_materials);
}
}
}
$dz = DB::selectParam("homework", "id_lessons", $id);
$answer = DB::selectSql("SELECT * FROM answer WHERE id_lessons={$id} AND id_clients={$_SESSION['user_id']}");
require_once 'view/tpl_top.php';
?>
<div class="app app-header-fixed">
<?php
include "view/tpl_popup_events.php";
include "view/header.php";
$active_a = "class=\"active\"";
include "view/nav.php";
?>
<!-- content -->
<div id="content" class="app-content" role="main">
示例5: save
/**
* Method to save the form data.
*
* @param array The form data.
* @return mixed The user id on success, false on failure.
* @since 1.6
*/
public function save($data)
{
//Payment type
$data['payment_type'] = json_encode($data['payment_type']);
$data['description'] = $data['content'];
unset($data['content']);
$imgTemp = JRequest::getVar('image-temp', array());
$images = $imgTemp;
//make object
$info = new stdClass();
foreach ($data as $key => $value) {
$info->{$key} = $value;
}
$id = $data['id'];
$db = JFactory::getDbo();
if ($info->id == 0) {
$db->insertObject('#__hp_business_service', $info);
if ($db->getErrorMsg()) {
die($db->getErrorMsg());
}
$id = $db->insertid();
}
if ($id) {
//TODO: Xu ly anh???
// require_once JPATH_ROOT.DS.'libraries'.DS.'hp'.DS.'upload.class.php';
$path = JPATH_ROOT . DS . 'images' . DS . 'users' . DS . $data['business_id'] . DS . 'services' . DS . $id;
@mkdir($path, 0777, true);
$files = Upload::files('image', $path);
foreach ($files as $file) {
if (is_array($file) && $file['result'] == 'OK') {
$images[] = $file['file_name'];
}
}
}
if (empty($images)) {
$images = array();
}
$info->id = $id;
$info->image = json_encode($images);
// update content
$content = $this->copyFilesOnSave($info->description, $info->id);
if ($content) {
$info->description = $content;
}
unset($info->content);
$db->updateObject('#__hp_business_service', $info, 'id');
if ($db->getErrorMsg()) {
die($db->getErrorMsg());
return false;
}
$id = $data['id'];
return $id;
}