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


PHP Upload::get_errors方法代码示例

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


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

示例1: action_commit

 public function action_commit()
 {
     $item = new Model_Item();
     $item->name = $_POST['item_name'];
     $item->phonetic = $_POST['phonetic'];
     $item->category = $_POST['category'];
     if ($_POST['category'] == 'ピザ') {
         $item->unit_price_s = $_POST['s_money'];
         $item->unit_price_m = $_POST['m_money'];
         $item->unit_price_l = $_POST['l_money'];
     } else {
         $item->unit_price = $_POST['money'];
     }
     $item->explanatory = $_POST['explanation'];
     $item_img = new Model_Itemimg();
     // 初期設定
     $config = array('path' => DOCROOT . DS . 'assets/img', 'randomize' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'));
     // アップロード基本プロセス実行
     Upload::process($config);
     // 検証
     if (Upload::is_valid()) {
         // 設定を元に保存
         Upload::save();
         $uploadfile = Upload::get_files(0);
         // 情報をデータベースに保存する場合
         $item_img->path = $uploadfile["name"];
     }
     foreach (Upload::get_errors() as $file) {
         // $file['errors']の中にエラーが入っているのでそれを処理
     }
     $item_img->save();
     $item->img_id = $item_img->id;
     $item->save();
     return View::forge('top/top');
 }
开发者ID:OICTH1,项目名称:Controlsystem,代码行数:35,代码来源:registration.php

示例2: moveUploadedFile

 /**
  * アップロードファイルを指定のフォルダに移動する
  *
  * @access public
  * @param array $config アップロードの設定
  * @return void
  * @author kobayashi
  * @author ida
  */
 public static function moveUploadedFile($config)
 {
     $default = array('ext_whitelist' => array('jpg'), 'randomize' => true);
     $config = array_merge($default, $config);
     \Upload::process($config);
     $is_upload = false;
     $result = array();
     if (\Upload::is_valid()) {
         \Upload::save();
         $files = \Upload::get_files();
         foreach ($files as $file) {
             $result[$file['field']] = $file;
         }
         $is_upload = true;
     } else {
         $error_files = \Upload::get_errors();
         foreach ($error_files as $file) {
             foreach ($file['errors'] as $error) {
                 if ($error['error'] != \Upload::UPLOAD_ERR_NO_FILE) {
                     $result[$file['field']] = $file;
                     $is_upload = false;
                 }
             }
         }
         if (empty($result)) {
             $is_upload = true;
         }
     }
     return array($is_upload, $result);
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:39,代码来源:image.php

示例3: action_index

 public function action_index()
 {
     $is_chenged = false;
     if ($this->user->bank == null) {
         $this->user->bank = Model_Bank::forge();
         $this->user->bank->user_id = $this->user->id;
         $this->user->bank->save();
     }
     if (Input::post("firstname", null) != null and Security::check_token()) {
         $email = Input::post("email", null);
         if ($email != $this->user->email) {
             $check_user = Model_User::find("first", ["where" => [["email" => $email]]]);
             if ($check_user == null) {
                 $this->email = $email;
             } else {
                 $data["error"] = "This email is already in use.";
             }
         }
         $config = ["path" => DOCROOT . "assets/img/pictures/", 'randomize' => true, 'auto_rename' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png')];
         Upload::process($config);
         if (Upload::is_valid()) {
             Upload::save();
             $saved_result = Upload::get_files();
             $file_name = $saved_result[0]['saved_as'];
             $image = Image::load($config["path"] . $file_name);
             $image->crop_resize(200, 200)->save($config["path"] . "m_" . $file_name);
             $image->crop_resize(86, 86)->save($config["path"] . "s_" . $file_name);
             $this->user->img_path = $file_name;
         } else {
             $error = Upload::get_errors();
         }
         if (!isset($data["error"])) {
             $this->user->firstname = Input::post("firstname", "");
             $this->user->middlename = Input::post("middlename", "");
             $this->user->lastname = Input::post("lastname", "");
             $this->user->google_account = Input::post("google_account", "");
             $this->user->pr = Input::post("pr", "");
             $this->user->educational_background = Input::post("educational_background", "");
             $this->user->enchantJS = Input::post("enchantJS", 0);
             $this->user->trial = Input::post("trial", 0);
             $this->user->save();
             $this->user->bank->name = Input::post("bank_name", "");
             $this->user->bank->branch = Input::post("bank_branch", "");
             $this->user->bank->account = Input::post("bank_account", "");
             $this->user->bank->number = Input::post("bank_number", "");
             $this->user->bank->etc = Input::post("bank_etc", "");
             $this->user->bank->type = Input::post("bank_type", 0);
             $this->user->bank->save();
             $is_chenged = true;
         }
     }
     $data["user"] = $this->user;
     $data["is_chenged"] = $is_chenged;
     $view = View::forge("teachers/profile", $data);
     $this->template->content = $view;
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:56,代码来源:profile.php

示例4: update_item

 public function update_item($post_data)
 {
     $upload_type = $this->def('upload_type', 'image');
     $upload_dir = \Config::get($upload_type . '_dir', 'files');
     $files = \Upload::get_files();
     $clean_class = str_replace('\\', '', $this->class);
     foreach ($files as $key => $params) {
         if ($params['field'] == $clean_class . '-' . ($this->item->id ? $this->item->id : 'new') . "-{$this->field}") {
             $idx = $key;
             break;
         }
     }
     if (isset($idx)) {
         \Upload::save(array($idx), $this->def('secure') ? realpath(\Config::get('secure_dir', 'secure') . $upload_dir) : DOCROOT . $upload_dir);
         $errors = \Upload::get_errors();
         if (!isset($errors[$idx])) {
             $files = \Upload::get_files();
             $name = $files[$idx]['saved_as'];
             $path = $files[$idx]['saved_to'];
             if ($upload_type == 'image') {
                 if ($dimensions = $this->def('dimension')) {
                     // resize image
                     $image = \Image::load($path . $name);
                     foreach ($dimensions as $dim) {
                         if (preg_match("/^(?P<width>[0-9]+)x(?P<height>[0-9]+)\$/i", $dim, $matches)) {
                             $image->resize($matches['width'], $matches['height'])->save_pa(null, strtolower("_{$dim}"));
                         }
                     }
                 }
             } elseif ($upload_type == 'audio') {
                 if ($lengths = $this->def('truncate')) {
                     if ($ffmpeg = \Config::get('ffmpeg')) {
                         foreach ($lengths as $len) {
                             // truncate audio track
                             $sample = preg_replace("/^(.+)\\.([^\\.]+)\$/", '$1_sample_' . $len . '.$2', $name);
                             // TODO: make an ffmpeg wrapper class
                             shell_exec("{$ffmpeg} -i " . escapeshellarg($path . $name) . " -t {$length} -acodec copy " . escapeshellarg(DOCROOT . $upload_dir . DS . $sample));
                         }
                     } else {
                         error_log("could not truncate audio: ffmpeg not configured.");
                     }
                 }
             }
             $this->item->{$this->field} = $name;
         } else {
             error_log(print_r($errors, true));
             return array('upload_error' => $this->def('desc') . ' failed to save. Error No. ' . $errors[$idx]['error']);
         }
     }
     return true;
 }
开发者ID:nathanharper,项目名称:fuel_cms_nh,代码行数:51,代码来源:upload.php

示例5: action_edit

 /**
  * Действие для редактирования данных игрока
  * 
  * @param int $id
  */
 public function action_edit($id = null)
 {
     is_null($id) and \Response::redirect_back('admin/players');
     if (!($player = \Model_Player::find($id))) {
         \Session::set_flash('error', 'Игрок не найден.');
         \Response::redirect_back('admin/players');
     }
     $val = \Model_Player::validate('edit');
     if ($val->run()) {
         // Валидация для фото
         $config = array('path' => DOCROOT . 'assets/img/players', 'randomize' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'));
         \Upload::process($config);
         if (\Upload::is_valid() or \Upload::get_errors()[0]['errors'][0]['error'] == 4) {
             $player->player_name = \Input::post('player_name');
             $player->is_core_player = \Input::post('is_core_player', 0);
             $player->position_id = \Input::post('position_id');
             $player->birthdate = strtotime(\Input::post('birthdate'));
             $player->data = \Input::post('data');
             if (!\Upload::get_errors()) {
                 // Сохраняем файл на диск
                 \Upload::save();
                 // Меняем размер изображения на 350px * 466px
                 $files = \Upload::get_files();
                 $path = $files[0]['saved_to'] . $files[0]['saved_as'];
                 \Image::load($path)->resize(350, 466, true)->save($path);
                 // Удаляем старый файл
                 if ($player->image_uri) {
                     unlink(DOCROOT . 'assets/img/players/' . $player->image_uri);
                 }
                 $player->image_uri = $files[0]['saved_as'];
             }
             if ($player->save()) {
                 \Session::set_flash('success', 'Игрок обновлён.');
                 \Response::redirect('admin/players');
             } else {
                 Session::set_flash('error', 'Could not update Player #' . $id);
             }
         }
     } else {
         if (\Input::method() == 'POST') {
             $player->player_name = $val->validated('player_name');
             $player->is_core_player = $val->validated('is_core_player');
             $player->position_id = $val->validated('position_id');
             $player->birthdate = strtotime($val->validated('birthdate'));
             $player->data = $val->validated('data');
             \Session::set_flash('error', $val->error());
         }
         $this->template->set_global('player', $player, false);
     }
     $this->template->content = \View::forge('players/edit');
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:56,代码来源:players.php

示例6: __construct

 public function __construct($arrParam = null, $options = null)
 {
     $this->_arrData = $arrParam;
     $this->_validate = \Validation::forge('validate');
     //$this->_validate->add_field('file_process_data', 'File Data', 'required');
     /*=======================================================
      * Start - validate file_process_data
      *=======================================================*/
     if (!empty($_FILES['file_process_data']['name'])) {
         $this->_upload = \Upload::process(array('path' => DOCROOT . 'files' . DS . 'sony_payment' . DS . 'file_data', 'ext_whitelist' => array('csv'), 'max_size' => '1024000000', 'suffix' => '_' . strtotime('now'), 'normalize' => true, 'auto_rename' => true));
         if (!\Upload::is_valid()) {
             $error = \Upload::get_errors('file_process_data');
             $this->_arrError['file_process_data'] = $error['errors'][0]['message'];
         }
     } else {
         $this->_arrError['file_process_data'] = 'アップロード名 は必須入力です。';
     }
 }
开发者ID:khoapossible,项目名称:vision_system,代码行数:18,代码来源:ProcessData.php

示例7: action_do_upload

 public function action_do_upload()
 {
     logger('1', 'Starting upload');
     \Upload::process(array('path' => './uploads', 'normalize' => true, 'change_case' => 'lower'));
     logger('1', 'Finished upload');
     echo "<pre>";
     print_r(\Upload::get_files());
     print_r(\Upload::get_errors());
     logger('1', 'Errors: ' . serialize(\Upload::get_errors()));
     echo \Upload::is_valid() ? "<span style='color: green; font-weight: bold;'>VALID</span>" : "<span style='color: red; font-weight: bold;'>ERROR</span>";
     echo '<br><br><br>';
     \Upload::save();
     echo 'Valid:<br>';
     print_r(\Upload::get_files());
     logger('1', 'Valid uploads: ' . serialize(\Upload::get_files()));
     echo '<br>Errors:<br>';
     print_r(\Upload::get_errors());
     echo "</pre>";
 }
开发者ID:huglester,项目名称:fuel-uploadify,代码行数:19,代码来源:uploadify.php

示例8: action_edit

 /**
  * Редактирование команды
  * 
  * @param int $id
  */
 public function action_edit($id = null)
 {
     is_null($id) and \Response::redirect('teams');
     if (!($team = \Model_Team::find($id))) {
         \Session::set_flash('error', 'Команда не найдена.');
         \Response::redirect_back('admin/competitions/teams');
     }
     $val = \Model_Team::validate('edit');
     if ($val->run()) {
         // Валидация для фото
         $config = array('path' => DOCROOT . 'assets/img/teams', 'randomize' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'));
         \Upload::process($config);
         if (\Upload::is_valid() or \Upload::get_errors()[0]['errors'][0]['error'] == 4) {
             $team->value = \Input::post('value');
             if (!\Upload::get_errors()) {
                 // Сохраняем файл на диск
                 \Upload::save();
                 // Меняем размер изображения на 50px * 50px
                 $files = \Upload::get_files();
                 $path = $files[0]['saved_to'] . $files[0]['saved_as'];
                 \Image::load($path)->resize(50, 50, true)->save($path);
                 // Удаляем старый файл
                 if ($team->logo_uri) {
                     unlink(DOCROOT . 'assets/img/teams/' . $team->logo_uri);
                 }
                 $team->logo_uri = $files[0]['saved_as'];
             }
             if ($team->save()) {
                 \Session::set_flash('success', 'Команда обновлена.');
                 \Response::redirect_back('admin/competitions/teams');
             } else {
                 Session::set_flash('error', 'Could not update Team #' . $id);
             }
         }
     } else {
         if (\Input::method() == 'POST') {
             $team->value = $val->validated('value');
             \Session::set_flash('error', $val->error());
         }
         $this->template->set_global('team', $team, false);
     }
     $this->template->content = \View::forge('competitions/teams/edit');
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:48,代码来源:teams.php

示例9: get_upload_file

 protected function get_upload_file($config)
 {
     try {
         Upload::process($config);
     } catch (Exception $e) {
         return null;
         // 未ログイン = アップロードなし = なにもしない
     }
     if (!Upload::is_valid()) {
         $files = Upload::get_errors();
         foreach ($files as $f) {
             foreach ($f['errors'] as $e) {
                 if ($e['error'] == 4) {
                     // no upload
                     continue;
                 } else {
                     $this->set_error([$f['field'] => 'ファイル形式が不正です'], true);
                 }
             }
         }
         if ($this->has_error()) {
             return false;
         }
     }
     return Upload::get_files();
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:26,代码来源:tpl.php

示例10: file_upload

 /**
  * ファイルアップロード<br>
  * 失敗した場合はfalseを返します。
  */
 private static function file_upload($shop_id)
 {
     if (is_null($shop_id)) {
         Log::error("parameter's shpo_id is null.");
         return false;
     }
     # ファイルアップロード設定
     $config = self::file_upload_config($shop_id);
     # アップロード実行
     Upload::process($config);
     # 検証
     if (Upload::is_valid()) {
         # アップロードファイルを保存(最初の1つを指定)
         Upload::save(0);
         foreach (Upload::get_files() as $file) {
             return $file['saved_as'];
         }
     }
     # エラー有り
     foreach (Upload::get_errors() as $file) {
         foreach ($file['errors'] as $error) {
             Log::error("file upload is fail. => {$error}", "file_upload");
         }
     }
     return false;
 }
开发者ID:leprafujii,项目名称:api,代码行数:30,代码来源:geo.php

示例11: action_discuss_brief

 public function action_discuss_brief()
 {
     if (\Input::post()) {
         // check for a valid CSRF token
         if (!\Security::check_token()) {
             \Messages::error('CSRF attack or expired CSRF token.');
             \Response::redirect(\Input::referrer(\Uri::create('/')));
         }
         $file = null;
         // Send autoresponder
         $autoresponder = \Autoresponder\Autoresponder::forge();
         $autoresponder->view_custom = 'discuss_brief';
         $autoresponder->view_admin = 'discuss_brief';
         $post = \Input::post();
         if ($product = \Product\Model_Product::find_one_by_id(\Input::post('product'))) {
             $post['product'] = $product;
         }
         $content['content'] = $post;
         $config = array('path' => APPPATH . 'tmp', 'normalize' => true, 'max_size' => 5242880);
         // Check if file uploaded
         if (isset($_FILES['fileUpload']['name']) && $_FILES['fileUpload']['name'] != '') {
             // process the uploaded files in $_FILES
             \Upload::process($config);
             // if there are any valid files
             if (\Upload::is_valid()) {
                 // save them according to the config
                 \Upload::save();
                 $file = \Upload::get_files(0);
             }
             // Upload errors
             if (\Upload::get_errors() !== array()) {
                 foreach (\Upload::get_errors() as $file) {
                     foreach ($file['errors'] as $key => $value) {
                         \Messages::error($value['message']);
                     }
                 }
                 \Response::redirect(\Input::referrer(\Uri::create('/')));
             }
         }
         $attachment = array();
         if (isset($file['saved_to']) && is_file($file['saved_to'] . $file['saved_as'])) {
             $attachment = array($file['saved_to'] . $file['saved_as']);
         }
         // echo 'test';
         // die;
         $content['subject'] = 'Thanks for contacting Evan Evans';
         $autoresponder->autoresponder_custom($content, \Input::post('email'), $attachment);
         $content['subject'] = 'Autoresponder Discuss Brief for Admin';
         $autoresponder->autoresponder_admin($content, \Config::get('auto_response_emails.discuss_brief'), $attachment);
         if ($autoresponder->send()) {
             \Messages::success('Thank You for sending request.');
         } else {
             \Messages::error('There was an error while trying to submit request.');
         }
         // Delete uploaded files
         if (!empty($attachment)) {
             foreach ($attachment as $file) {
                 if (is_file($file)) {
                     unlink($file);
                 }
             }
         }
         \Response::redirect(\Input::referrer(\Uri::create('/')));
     }
     if (\Input::is_ajax()) {
         $products = \Product\Model_Product::fetch_pair('id', 'title', array('order_by' => array('title' => 'asc')));
         echo \Theme::instance()->view('views/_partials/discuss_brief')->set('products', $products, false);
         exit;
     }
     throw new \HttpNotFoundException();
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:71,代码来源:page.php

示例12: action_edit

 public function action_edit($id = null)
 {
     $val = Model_shop::validate('create');
     if (Input::method() == 'POST') {
         $config = array('path' => 'files/temp/', 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'));
         Upload::process($config);
         $image_path = '';
         if (Upload::is_valid()) {
             Upload::save();
             $file = Upload::get_files(0);
             $image_path = $file['name'];
             Session::set_flash('success', $file['name'] . " has been uploaded successfully.");
         } else {
             $error_file = Upload::get_errors(0);
             Session::set_flash('error', $error_file["errors"][0]["message"]);
         }
         if ($val->run()) {
             Session::set('id', Input::post('id'));
             Session::set('name', Input::post('name'));
             Session::set('postal_code', Input::post('postal_code'));
             Session::set('address', Input::post('address'));
             Session::set('pref', Input::post('pref'));
             Session::set('detail', Input::post('detail'));
             Session::set('category', Input::post('category'));
             Session::set('catchphrase', Input::post('catchphrase'));
             Session::set('hp_url', Input::post('hp_url'));
             Session::set('tel', Input::post('tel'));
             Session::set('image_path', $image_path);
             Session::set('holiday', Input::post('holiday'));
             Session::set('open_hh', Input::post('open_hh'));
             Session::set('open_mm', Input::post('open_mm'));
             Session::set('close_hh', Input::post('close_hh'));
             Session::set('close_mm', Input::post('close_mm'));
             Response::redirect('shop/confirm.php');
         } else {
             // バリデーションNGの場合
             Session::set_flash('error', $val->show_errors());
         }
     } else {
         $data['shop'] = Model_shop::find($id);
         $this->template->header = View::forge('docs-header-simple.php');
         $this->template->error = View::forge('error.php');
         $this->template->content = View::forge('shop/edit.php', $data);
         $this->template->sns = "";
         $this->template->footer = View::forge('footer.php');
         $this->template->daialog = View::forge('daialog.php');
     }
 }
开发者ID:kawanoseiya,项目名称:TEMP,代码行数:48,代码来源:shop.php

示例13: action_img

 /**
  * Edit background of category
  *
  * @param int $id cat. ID
  *
  * @author Nguyen Van Hiep
  * @access public
  *
  * @version 1.0
  * @since 1.0
  */
 public function action_img($id = null)
 {
     $cat = Model_Categories::get_cat_with_expected_size($id);
     if (!$cat or $id < 4) {
         Session::set_flash('error', __('message.cat_not_exists'));
         Response::redirect('admin/categories');
     }
     $this->add_js('img_preparation.js');
     $up_dir = DOCROOT . 'assets/img/cat/temp/';
     $img_dir = DOCROOT . 'assets/img/cat/';
     $view = View::forge('admin/categories/img');
     $view->cat = $cat;
     $view->error = array();
     $view->img = '';
     $view->width = 0;
     $view->height = 0;
     $view->pw = 0;
     $view->ph = 0;
     $view->rat = $cat['sizes'];
     if (Input::post('submit') == 'upload') {
         // Custom configuration for this upload
         $config = array('path' => $up_dir, 'randomize' => false, 'ext_whitelist' => array('jpg', 'jpeg', 'gif', 'png'), 'max_size' => MAX_IMG_SIZE, 'auto_rename' => true, 'overwrite' => false, 'prefix' => 'c' . $id . '_');
         Upload::process($config);
         if (Upload::is_valid()) {
             File::delete_dir($up_dir, true, false);
             Upload::save();
             $info = Upload::get_files(0);
             $filepath = $info['saved_to'] . $info['saved_as'];
             $view->img = $info['saved_as'];
             list($view->width, $view->height) = getimagesize($filepath);
             list($view->pw, $view->ph) = explode(':', $cat['sizes']);
             Session::set_flash('success', __('message.slider_uploaded'));
         } else {
             $err = Upload::get_errors()[0]['errors'][0];
             $view->error['img'] = $err['message'];
         }
     }
     if (Input::post('submit') == 'save') {
         $x1 = Input::post('x1');
         $y1 = Input::post('y1');
         $x2 = Input::post('x2');
         $y2 = Input::post('y2');
         $w = Input::post('w');
         $h = Input::post('h');
         $img = Input::post('img');
         $scale = 1;
         $this->resize_img($img_dir . $img, $up_dir . $img, $w, $h, $x1, $y1, $scale);
         Model_Categories::save_bg($id, $img, $cat['bg']);
         Session::set_flash('success', __('message.img_resized'));
         Response::redirect('admin/categories');
     }
     $this->template->title = __('cat.edit');
     $this->template->content = $view;
 }
开发者ID:aminh047,项目名称:pepperyou,代码行数:65,代码来源:categories.php

示例14: try_get_attachments

 /**
  * Tries to get attachments from uploaded files
  * @param type $event
  * @return array list of errors
  */
 private function try_get_attachments($event = null)
 {
     //first we check if there is probably a file
     //already stored from previous submissions.
     $old_file = Session::get("uploaded_file_" . Input::post("form_key"), null);
     if ($old_file != null and $event != null) {
         $event->poster = $old_file;
         $event->save();
         return array();
     }
     //no "old files" exist, let's catch the new ones!
     $config = array('path' => APPPATH . 'files', 'randomize' => false, 'auto_rename' => true, 'ext_whitelist' => array('pdf'));
     // process the uploaded files in $_FILES
     Upload::process($config);
     // if there are any valid files
     if (Upload::is_valid()) {
         // save them according to the config
         Upload::save();
         //call a model method to update the database
         $newfile = Upload::get_files(0);
         if ($event != null) {
             $event->poster = $newfile["saved_as"];
             $event->save();
             return array();
             //done, no errors
         } else {
             //there is no event yet (validation problems)
             //but there are uploaded files.
             //We store this information in the session
             //so that the next time user submits the form
             //with validation errors fixed, we can attach the "old" file
             Session::set("uploaded_file_" . Input::post("form_key"), $newfile["saved_as"]);
             return array();
             //no errors here!
         }
     } else {
         if (count(Upload::get_errors()) > 0) {
             //there was some problem with the files
             return array("The uploaded file could not be saved");
         } else {
             return array();
         }
     }
 }
开发者ID:beingsane,项目名称:TTII_2012,代码行数:49,代码来源:event.php

示例15: file_upload

 protected function file_upload()
 {
     // File upload configuration
     $this->file_upload_config = array('path' => \Config::get('details.file.location.root'), 'normalize' => true, 'ext_whitelist' => array('pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt'));
     // process the uploaded files in $_FILES
     \Upload::process($this->file_upload_config);
     // if there are any valid files
     if (\Upload::is_valid()) {
         // save them according to the config
         \Upload::save();
         \Messages::success('File successfully uploaded.');
         $this->uploaded_files = \Upload::get_files();
         return true;
     } else {
         // FILE ERRORS
         if (\Upload::get_errors() !== array()) {
             foreach (\Upload::get_errors() as $file) {
                 foreach ($file['errors'] as $key => $value) {
                     \Messages::error($value['message']);
                 }
             }
             \Response::redirect(\Uri::admin('current'));
         }
     }
     return false;
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:26,代码来源:order.php


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