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


PHP FileSystem::Upload方法代码示例

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


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

示例1: add

 public function add($order_id)
 {
     import('system/share/network/redirect');
     AuthPlugins::required($this, array('销售经理', '销售顾问'));
     $order_id = abs(intval($order_id));
     if (!$this->is_post() || !$order_id) {
         return false;
     }
     /*
      * 上传方案附件
      */
     import('system/share/io/filesystem');
     FileSystem::init();
     $file_path = FileSystem::Upload($_FILES['attachment'], false);
     if (!$file_path) {
         HTTPRedirect::flash_to('order/detail/' . $order_id, '文件上传失败:' . FileSystem::$message, $this->smarty);
     }
     /*
      * 写入方案表
      */
     parent::load('model', 'order');
     $solution = new Solution();
     $solution->order_id = $order_id;
     $solution->solution_code = trim(strip_tags($_POST['solution_code']));
     $solution->name = trim(strip_tags($_POST['name']));
     $solution->attachment = $file_path;
     $solution->price = abs(intval($_POST['price']));
     $solution->save();
     HTTPRedirect::flash_to('order/detail/' . $order_id, '添加方案成功', $this->smarty);
 }
开发者ID:uwitec,项目名称:mgoa,代码行数:30,代码来源:SolutionController.php

示例2: upload

 public function upload()
 {
     import('system/share/io/datastream');
     import('system/share/io/filesystem');
     FileSystem::init();
     $http_path = FileSystem::Upload($_FILES['imgFile'], true);
     if (!$http_path) {
         $data = array('error' => 1, 'message' => FileSystem::$message);
     } else {
         $data = array('error' => 0, 'url' => $http_path);
     }
     echo Datastream::output('json', $data);
 }
开发者ID:uwitec,项目名称:mgoa,代码行数:13,代码来源:EditorController.php

示例3: decide_programe

 public function decide_programe($order_id)
 {
     $workflow = Workflow::get_by_alias('程序验收完成');
     import('system/share/io/filesystem');
     FileSystem::init();
     $http_path = FileSystem::Upload($_FILES['attachment']);
     if (!$_FILES['attachment'] || !$http_path) {
         HTTPRedirect::flash_to('customer', '请您上传首页确认书的扫描件', $this->smarty, 'cus_flash_to');
     }
     $order = Order::get_by_id($order_id);
     $order->programe_decide_attachment = $http_path;
     $order->save();
     Order::set_workflow($order_id, $workflow);
     $smarty = parent::load('smarty');
     import('system/share/network/redirect');
     $message = '程序验收完成,等待客户付尾款即可上线';
     $flash_to = $userinfo['role']['0']['alias'] == '技术经理' ? 'order/list/' . $workflow->id : 'customer';
     $template = $userinfo['role']['0']['alias'] == '技术经理' ? 'flash_to' : 'cus_flash_to';
     HTTPRedirect::flash_to($flash_to, $message, $smarty, $template);
 }
开发者ID:uwitec,项目名称:mgoa,代码行数:20,代码来源:CustomerController.php

示例4: contract

 public function contract($order_id, $step = null)
 {
     AuthPlugins::required($this, array('销售经理', '销售顾问'));
     $order_id = abs(intval($order_id));
     $order = Order::get_by_id($order_id);
     if (!$step) {
         $step = 'solution';
     }
     $smarty = parent::load('smarty');
     $smarty->assign('order', $order);
     switch ($step) {
         case 'solution':
             $solution_id = abs(intval($_GET['id']));
             if ($solution_id) {
                 /*
                  * 全部设为非选定方案
                  */
                 Solution::set_unchecked();
                 /*
                  * 选定某个方案
                  */
                 Solution::select($solution_id);
                 HttpRedirect::to('order/contract/' . $order_id . '/paper');
             } else {
                 $solutions = Solution::get_by_order($order_id);
                 if (!$solutions) {
                     $message = '您还没有为此订单添加方案, 请返回添加';
                     HTTPRedirect::flash_to('order/detail/' . $order_id, $message, $smarty);
                 }
                 $smarty->assign('page_title', '签约订单 - 选定方案 Step 1');
                 $smarty->display('contract/solution');
             }
             break;
         case 'paper':
             if (!Solution::get_checked($order_id)) {
                 $message = '您还没有选择方案, 请返回选择';
                 HTTPRedirect::flash_to('order/contract/' . $order_id . '/solution', $message, $smarty);
             }
             if ($this->is_post() || $_FILES) {
                 import('system/share/io/filesystem');
                 FileSystem::init();
                 $http_path = FileSystem::Upload($_FILES['paper_attachment'], false);
                 if (!FileSystem::$local_path) {
                     $message = '不支持的附件类型, 请检查';
                     HTTPRedirect::flash_to('order/detail/' . $order_id, $message, $smarty);
                 }
                 $order->paper_attachment = $http_path;
                 $order->save();
                 HTTPRedirect::flash_to('order/contract/' . $order_id . '/payment', '上传合同成功', $this->smarty);
             } else {
                 $smarty->assign('page_title', '签约订单 - 上传合同附件 Step 2');
                 $smarty->display('contract/paper');
             }
             break;
         case 'payment':
             if ($this->is_post()) {
                 /*
                  * 获取选定的订单方案
                  */
                 $solution = Solution::get_checked($order_id);
                 /*首付款*/
                 $first_pay = new Payment();
                 $first_pay->order_id = $order_id;
                 $first_pay->type = 'first';
                 $first_pay->price = abs(intval($_POST['deposit']));
                 $first_pay->invoice = abs(intval($_POST['invoice']));
                 $first_pay->public = abs(intval($_POST['pub']));
                 $first_pay->bank = trim(strip_tags($_POST['bank']));
                 $first_pay->is_payed = abs(intval($_POST['is_deposit']));
                 $first_pay->save();
                 /*二期款*/
                 $second_pay = new Payment();
                 $second_pay->order_id = $order_id;
                 $second_pay->type = 'second';
                 $second_pay->price = abs(intval($_POST['payment']));
                 $second_pay->invoice = abs(intval($_POST['invoice']));
                 $second_pay->public = abs(intval($_POST['pub']));
                 $second_pay->bank = trim(strip_tags($_POST['bank']));
                 $second_pay->is_payed = abs(intval($_POST['is_payment']));
                 $second_pay->save();
                 /*尾款*/
                 $last_pay = new Payment();
                 $last_pay->order_id = $order_id;
                 $last_pay->type = 'last';
                 $last_pay->price = abs(intval($_POST['last_pay']));
                 $last_pay->invoice = abs(intval($_POST['invoice']));
                 $last_pay->public = abs(intval($_POST['pub']));
                 $last_pay->bank = trim(strip_tags($_POST['bank']));
                 $last_pay->is_payed = abs(intval($_POST['is_last_pay']));
                 $last_pay->save();
                 $old_workflow = $order->Workflow->action;
                 $workflow = Workflow::get_by_alias('新增财务订单');
                 $order->Workflow = $workflow;
                 $order->save();
                 /*
                  * 在用户表中写入客户的登录信息
                  * 登录名为客户填写的名字加订单ID
                  * 密码为'MG-客服ID-订单号'
                  */
                 $user = new User();
//.........这里部分代码省略.........
开发者ID:uwitec,项目名称:mgoa,代码行数:101,代码来源:OrderController.php

示例5: add_customer

 public function add_customer()
 {
     AuthPlugins::required($this, '客服');
     $smarty = parent::load('smarty');
     $smarty->assign('page_title', '新增订单');
     if ($this->is_post()) {
         unset($_POST['CSRF_TOKEN']);
         unset($_POST['sub4']);
         $model = parent::load('model', 'order');
         $time_str = sprintf('%s %s:%s', $_POST['subscribe_time'], $_POST['book_hour'], $_POST['book_minu']);
         $_POST['subscribe_time'] = date('Y-m-d H:i', strtotime($time_str));
         try {
             $customer = new Customer();
             $order = new Order();
             foreach ($_POST as $k => $v) {
                 if (isset($customer->{$k})) {
                     $customer->{$k} = trim(htmlspecialchars($v));
                 } else {
                     if (isset($order->{$k})) {
                         $order->{$k} = trim(htmlspecialchars($v));
                     }
                 }
             }
             /*
              * 客户提供资料
              */
             if ($_FILES['cus_docs']) {
                 import('system/share/io/filesystem');
                 FileSystem::init();
                 $http_path = FileSystem::Upload($_FILES['cus_docs'], false);
                 $customer->docs = $http_path;
             }
             /*
              * 保存客户信息
              */
             $customer->save();
             /*
              * 取得工作流程ID(订单状态)
              */
             $workflow = Workflow::get_by_alias('新增订单管理');
             /*
              * 新建订单, 并写入当前的订单初始信息
              */
             $order->Customer = $customer;
             $order->Workflow = $workflow;
             /*
              * 客服
              */
             $order->CustomerService = User::current();
             $order->save();
             import('system/share/network/redirect');
             $message = '订单信息录入成功, 转入新增订单管理页面';
             /*
              * 清除订单列表缓存
              */
             //                $smarty->clearCache('order/list');
             $smarty->clearAllCache();
             HTTPRedirect::flash_to($workflow['action'], $message, $smarty);
         } catch (Doctrine_Query_Exception $e) {
             $smarty->raise('system');
         }
     } else {
         parent::load('form', 'NewCustomer');
         $smarty->display('customer/add');
     }
 }
开发者ID:uwitec,项目名称:mgoa,代码行数:66,代码来源:CustomerController.php


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