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

Use following echo $this->Form->create(‘Tour’,array(‘autocomplete’ => ‘off’,’enctype’=>’multipart/form-data’)); Allows image/video data to be processed. Inside controller if ($this->request->is(‘post’)) { if(is_uploaded_file($this->request->data[‘Tour’][‘varbigimg’][‘tmp_name’])) { $fileNameFull = $this->request->data[‘Tour’][‘varbigimg’][‘name’]; $oldFile=”../../app/webroot/img/”.$fileNameFull; move_uploaded_file( $this->request->data[‘Tour’][‘varbigimg’][‘tmp_name’], $oldFile ); $this->Tour->create(); $this->request->data[‘Tour’][‘varbigimg’] = $fileNameFull; //HERE you need to specify same for thum $this->request->data[‘Tour’][‘varthumimg’] = $fileNameFull; ////HERE you need to specify same for thumbfield if ($this->Tour->save($this->request->data)) { $this->Session->setFlash(__(‘Your possstt … Read more

[Solved] How to prevent SQL injections in manually created queries?

I dont want to use other method You should use whatever provides the required functionality, not the method that you like more over others! Also you should never access superglobals directly in CakePHP, this will only bring you in trouble, especially in unit tests. User the proper abstracted methodes provided by the request object, that … Read more