コード例 #1
0
 /**
  *This method creats a mailing list in the database in the database
  *@param null
  *@return void
  */
 public function postAddnew()
 {
     //upload the submitted file
     $upload_file = Upload::doUpload('list_csv', 'application/storage/mailing_list_csvs/');
     //proceed if file upload success
     if ($upload_file->success === true) {
         //compose data to save in table
         $list_info = array('name' => Input::get('list_name'), 'description' => Input::get('list_description'), 'recipients' => 0, 'campaigns' => 0, 'csv_file_path' => $upload_file->upload_path_relative);
         //call model to save this information into the database
         $create_list = ListsModel::create($list_info);
         if ($create_list->lastInsertId()) {
             //redirect to manage new list page
             $data = array('list_id' => $create_list->lastInsertId());
             Redirect::with($data)->to('lists/managenew');
         }
     }
 }
コード例 #2
0
 /**
  * This methods upload a user's profile pic.
  * @param int $user_id The id of the user whose photo we upload
  * @return void
  */
 public function saveProfilePic($user_id)
 {
     $upload = Upload::doUpload('profile-pic');
     if ($upload->success) {
         $save_pic_path = UsersModel::where('id = ?', $user_id)->save(array('profile_pic' => substr($upload->upload_path_relative, 7)));
         $userInfo = UsersModel::where('id = ?', $user_id)->all();
         $userInfo = $userInfo->result_array();
         Session::set('userInfo', $userInfo[0]);
         if ($save_pic_path->updateSuccess()) {
             Redirect::to(array('admin'));
         }
     }
 }