当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtils::GetPath方法代码示例

本文整理汇总了PHP中FileUtils::GetPath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::GetPath方法的具体用法?PHP FileUtils::GetPath怎么用?PHP FileUtils::GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtils的用法示例。


在下文中一共展示了FileUtils::GetPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upfile

 public function upfile($file, $fields)
 {
     $rs = FileUtils::upfile($file, true);
     if ($rs != false) {
         $fields['name'] = $rs;
         $fields['url'] = FileUtils::GetPath() . "/" . $fields['name'];
     }
     $this->insertFile($fields);
     return $fields;
 }
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:10,代码来源:TaskOperation.php

示例2: Validate

require_once 'core/init.php';
if (Input::exists('post')) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('title' => array('required' => true, 'name' => 'title'), 'type' => array('required' => true, 'name' => 'title'), 'endtime' => array('required' => true, 'name' => 'endtime'), 'desc' => array('required' => true, 'name' => 'desc')));
        if ($validation->passed()) {
            $teacher = new Teacher();
            try {
                $teacher->_taskOperation->taskCreate(array('title' => Input::get('title'), 'teacher_id' => $teacher->data()->id, 'type' => Input::get('type'), 'end_time' => strtotime(Input::get('endtime')), 'context' => Input::get('desc')));
                $validate->check($_POST, array('uploadfile' => array('required' => true, 'name' => 'uploadfile')));
                if ($validation->passed()) {
                    $arr = Input::get('uploadfile');
                    $taskID = $teacher->_taskOperation->getLastId();
                    foreach ($arr as $file) {
                        echo $file;
                        $teacher->_taskOperation->insertFile(array('name' => $file, 'teacher_id' => $teacher->data()->id, 'url' => FileUtils::GetPath() . "/" . $file, 'task_id' => $taskID));
                    }
                }
                Redirect::to('taskdetail.php?taskmark=' . $taskID);
                // Redirect::to('course.php');
            } catch (Exception $e) {
                die($e->getMessage());
            }
        } else {
            $errorInfo = '';
            foreach ($validation->errors() as $error) {
                //echo $error;
                $errorInfo .= $error . '<br>';
            }
            echo $errorInfo;
        }
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:31,代码来源:insertTask_run.php

示例3: Validate

$res["error"] = "";
//错误信息
$res["msg"] = "";
//提示信息
if (Input::exists('post')) {
    if (1) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('taskId' => array('required' => true, 'name' => 'taskId')));
        if ($validation->passed()) {
            $teacher = new Teacher();
            try {
                $file = Input::getFile('file');
                if ($file['error'] > 0) {
                    $res["error"] = "error";
                } else {
                    $rs = $teacher->_taskOperation->upfile($file, array('name' => $file['name'], 'url' => FileUtils::GetPath() . "/" . $file['name'], 'task_id' => Input::get('taskId')));
                    Session::flash("taskdetail", "上传成功");
                    $res["msg"] = "ok";
                }
            } catch (Exception $e) {
                Session::flash("taskdetail", "上传失败");
                $res["error"] = "error:" . $e->getMessage();
            }
        } else {
            $errorInfo = '';
            foreach ($validation->errors() as $error) {
                //echo $error;
                $errorInfo .= $error . '<br>';
            }
            Session::flash("taskdetail", "上传失败");
            $res["error"] = 'failed:' . $errorInfo;
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:31,代码来源:upfile.php

示例4: Teacher

<?php

require_once 'core/init.php';
$res["error"] = "";
//错误信息
$res["msg"] = "";
//提示信息
$teacher = new Teacher();
try {
    $file = Input::getFile('inputFile');
    if ($file['error'] > 0) {
        $res["error"] = "error";
    } else {
        $rs = FileUtils::upfile($file, true);
        if ($rs != false) {
            $res["msg"] = $rs;
            $res["url"] = FileUtils::GetPath() . "/" . $file['name'];
        }
    }
} catch (Exception $e) {
    $res["error"] = "error:" . $e->getMessage();
}
echo json_encode($res);
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:23,代码来源:createfile_run.php


注:本文中的FileUtils::GetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。