cakephp-2.3

cakephp 2.3 how to manage file upload for users and display the files when they are logged in?

廉价感情. 提交于 2020-01-05 08:44:33
问题 so far what I have managed to do is upload the file in app/files directory and download them using the deprecated media views. I am unable to use $file = $this->Attachment->getFile($id); and i want to display the images/files to the user, say like a profile image of the user. How can i get this done without comprising on the security of the user images. I get the error Call to a member function getFile() on a non-object I don't want to use any plugins for the same. Thanks in advance. 回答1: You

Plugin model assiciation is not working in cakephp 2.3 with cake ACL

喜你入骨 提交于 2020-01-04 05:55:59
问题 I am just trying to implement Cakephp ACL user authentication in a plugin named "Cauth". The same thing I implements before was working fine. This time the difference is, it is under plugin. Here, in controller, $this->User->Group->find('list'); is not working. I got the following fatal error: Fatal Error Error: Call to a member function find() on a non-object File: my_dir_path\app\Plugin\Cauth\Controller\UsersController.php Line: 60 Notice: If you want to customize this error message, create

CakePHP security component blackholing login (data[_Token][key] field not generated)

点点圈 提交于 2020-01-03 09:57:11
问题 When I try to login, the request gets blackholed by teh Security component. How can I make it work right? I have a simple login form <div class="container container-login"> <h2><?php echo __('Login'); ?></h2> <div class="wrap-form-signin"> <?php echo $this->Form->create('User', array('action' => 'login', 'class' => 'form-signin')); echo $this->Form->input('username', array('label' => '', 'placeholder' => __('Email'))); echo $this->Form->input('password', array('label' => '', 'placeholder' =>

Making jquery ajax call from view to controller in cakephp 2.x

北慕城南 提交于 2019-12-31 04:31:06
问题 I Am trying to make an ajax request from the view to controller, ajax requst is working fine, but from controller nothing is returned back to the view. i don't know where is the problem.. what i am trying is in my view side i am displaying some data from the controller and there is one select box. whe i select a city from the select box, it calls the ajax request and should show the result from that particular city in the view.ctp. $('#cityid').change(function() { $city_id= $('#cityid

how to upload image in cakephp2.5+ and store it in webroot folder [closed]

♀尐吖头ヾ 提交于 2019-12-25 19:57:11
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . my controller public function add() { $this->helpers = array('TinyMCE.TinyMCE'); $this->layout = 'adminpanel'; if ($this->request->is('post')) { $this->Tour->create(); if ($this->Tour->save($this->request->data)) { $this->Session->setFlash(__('Your possstt has been saved.')); return $this->redirect

CakePHP save failing with validation errors set but empty

空扰寡人 提交于 2019-12-25 11:51:08
问题 A model that I am using with both TranslateBehavior and TreeBehavior is failing to save. I suspect it is something to do with one of these behaviors. Here's the data going in: array( 'Category' => array( 'id' => '3252', 'parent_id' => null, 'sort_order' => '0', 'name' => array( 'eng' => 'english name', 'fra' => 'french name', 'deu' => 'german name', 'ita' => 'italian name', 'spa' => 'spanish name' ), ) ) And $this->Category->validationErrors is: array( 'parent_id' => array(), 'sort_order' =>

CakePHP placing array items into diferrent cells CsvView plugin

随声附和 提交于 2019-12-25 06:06:26
问题 I have started to export csv files with the help of CsvView plugin, but am stuck at one place. So here is the controller code: function export(){ $data = array( array('37899810', '50001', '1', '7616'), ); $_serialize = 'data'; $this->response->download('export.csv'); $this->viewClass = 'CsvView.Csv'; $this->set(compact('data', '_serialize')); } The problem is that the whole array is printed in a single cell, where I would like every item of an array to be placed in its own cell. Any help is

Get post data from Android to PHP

僤鯓⒐⒋嵵緔 提交于 2019-12-25 04:15:48
问题 I have a problem to receive post data from Android to CakePHP 2.3. Below is my code. This function returns values which are in JSON object form. public static JSONObject getJSONFromUrl(String url, JSONObject jObj) { // Making HTTP request InputStream is = null; try { // Default HTTP Client DefaultHttpClient httpClient = new DefaultHttpClient(); // HTTP POST Header HttpPost httpPost = new HttpPost(url); StringEntity se = new StringEntity(jObj.toString()); httpPost.setEntity(se); httpPost

cakephp 2.3 login to different table with custom Auth components

≯℡__Kan透↙ 提交于 2019-12-25 03:52:47
问题 I've trying to login a user to 2 differents tables tmp_users, active_users, inside UsersController. I've created two custom Auth components one for each. App::uses('FormAuthenticate', 'Controller/Component/Auth'); class TmpUserAuthenticate extends FormAuthenticate { } and App::uses('FormAuthenticate', 'Controller/Component/Auth'); class ActiveAuthenticate extends FormAuthenticate { } In my controller I have this: Components: public $components = array( 'Cookie', 'Session', 'Auth' => array(

CakePHP mapping HTTP request to the correct action

橙三吉。 提交于 2019-12-25 02:58:43
问题 I have been trying to set up RESTful functionality in my app and I face a problem of whatever action I call it is router to that particular controllers index action. I have been trying to call add and view actions, but they are just not being routed properly. Here is the resposne I get when trying to call the view action: {"code":404,"url":"\/application\/rest_customers\/54.json","name":"Action RestCustomersController::54() could not be found."} And here is the way it is all set up in.