[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