Re: Problem in simple file upload
View the source of your HTML and make sure the form action is pointing to the right URL. Also what version of the Uploader are you using? You should download the latest version off of Github. Furthermore, your file type must be supported, if it is not, you have to add it to the mime types array. On Feb 1, 3:11 pm, newguy wrote: > I checked the _mime types but couldnt find a error in there, am stuck > guys please suggest something. > > On Feb 1, 2:50 pm, Stephen wrote: > > > Nope, you called the field "aiman". So when checking for the file, check the > > field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] > > > On 1 February 2011 22:43, newguy wrote: > > > > Stephen one simple question, this line in upload.cpt > > > echo $form->input('aiman', array('type' => 'file')); > > > means that I can upload only file named aiman?? > > > > On Feb 1, 2:17 pm, Stephen wrote: > > > > This error tells me that your form is successfully reaching the correct > > > > action "upload". > > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > > > syntax > > > > is correct enough. > > > > > On 1 February 2011 21:55, newguy wrote: > > > > > > I tried that, this time no call was made to add action but I got this > > > > > warning: > > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > > > controllers/components/uploader.php, line 1084] > > > > > > This is the foreach in which warning is coming: > > > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > > > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > > > { > > > > > $validExt = true; > > > > > } > > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > > > Try > > > > > > > create('User',array('action' => 'upload', > > > > > > 'type'=>'file')); ?> ? > > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > Hi I am following this uploader plugin to implement simple file > > > upload > > > > > > > on my site: > > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > > but the problem is that when I press the upload button call to a > > > > > > > unknown action add is made, I dont have any action by the name of > > > add, > > > > > > > here is my code: > > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > > > upload score: > > > > > > > > / > > > > > > > index.cpt > > > > > > > > > > > > > > Hello, > > $user['last_name']); ? > > > > > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > > > > > link('Upload > > > Score',array('action'=>'upload')); ? > > > > > > > > > > > > > > > link('logout', array('action' => 'logout')); > > > ?> > > > > > > li> > > > > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > > > > upload.cpt > > > > > > > // > > > > > > > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > > > > //echo $form->file('File'); > > > > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > > > > //echo $form->submit('Upload'); > > > > > > > echo $form->end('Upload2'); > > > > > > > ?> > > > > > > > > now when I press upload2 button I get the following error: > > > > > > > > > > > > > > Missing Method in UsersController > > > > > > > Error: The action add is not defined in controller UsersController > > > > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > > > > users_controller.php. > > > > > > > > > > > > > > class UsersController extends AppController { > > > > > > > > var $name = 'Users'; > > > > > > > > function add() { > > > > > > > > } > > > > > > > > } > > > > > > > ?> > > > > > > > /// > > > > > > > > Here is my controller: > > > > > > > > > > > > > > > class UsersController extends AppController > > > > > > > { > > > > > > > var $name = 'Users'; > > > > > > > var $helpers = array('Html', 'Form'); > > > > > > > var $components = array('Uploader.Uploader'); > > > > > > > > function register() > > > > > > > { > > > > > > > if (!empty($this->data)) > > > > > > > { > > > > > > > $this->data['User']['password'] = > > > > > > > md5($this->data['User'] > > > > > > > ['password']); > > > > > > > if ($this->User->save($this->data)) > > > > > > > { > > > > $this->Session->setFlash('Your > > > > > > > registration information was > > > > > > > accepted'); > > > > $this->Session->write('user', > > > > > > > $this->data['User']['username']); > > > > $this->redirect(array('ac
Re: Problem in simple file upload
I checked the _mime types but couldnt find a error in there, am stuck guys please suggest something. On Feb 1, 2:50 pm, Stephen wrote: > Nope, you called the field "aiman". So when checking for the file, check the > field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] > > On 1 February 2011 22:43, newguy wrote: > > > > > > > > > > > Stephen one simple question, this line in upload.cpt > > echo $form->input('aiman', array('type' => 'file')); > > means that I can upload only file named aiman?? > > > On Feb 1, 2:17 pm, Stephen wrote: > > > This error tells me that your form is successfully reaching the correct > > > action "upload". > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > > syntax > > > is correct enough. > > > > On 1 February 2011 21:55, newguy wrote: > > > > > I tried that, this time no call was made to add action but I got this > > > > warning: > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > > controllers/components/uploader.php, line 1084] > > > > > This is the foreach in which warning is coming: > > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > > { > > > > $validExt = true; > > > > } > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > > Try > > > > > > create('User',array('action' => 'upload', > > > > > 'type'=>'file')); ?> ? > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > Hi I am following this uploader plugin to implement simple file > > upload > > > > > > on my site: > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > but the problem is that when I press the upload button call to a > > > > > > unknown action add is made, I dont have any action by the name of > > add, > > > > > > here is my code: > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > > upload score: > > > > > > > / > > > > > > index.cpt > > > > > > > > > > > > Hello, > $user['last_name']); ? > > > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > > > link('Upload > > Score',array('action'=>'upload')); ? > > > > > > > > > > > > > link('logout', array('action' => 'logout')); > > ?> > > > > > li> > > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > > upload.cpt > > > > > > // > > > > > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > > > //echo $form->file('File'); > > > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > > > //echo $form->submit('Upload'); > > > > > > echo $form->end('Upload2'); > > > > > > ?> > > > > > > > now when I press upload2 button I get the following error: > > > > > > > > > > > > Missing Method in UsersController > > > > > > Error: The action add is not defined in controller UsersController > > > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > > > users_controller.php. > > > > > > > > > > > > class UsersController extends AppController { > > > > > > > var $name = 'Users'; > > > > > > > function add() { > > > > > > > } > > > > > > > } > > > > > > ?> > > > > > > /// > > > > > > > Here is my controller: > > > > > > > > > > > > > class UsersController extends AppController > > > > > > { > > > > > > var $name = 'Users'; > > > > > > var $helpers = array('Html', 'Form'); > > > > > > var $components = array('Uploader.Uploader'); > > > > > > > function register() > > > > > > { > > > > > > if (!empty($this->data)) > > > > > > { > > > > > > $this->data['User']['password'] = > > > > > > md5($this->data['User'] > > > > > > ['password']); > > > > > > if ($this->User->save($this->data)) > > > > > > { > > > $this->Session->setFlash('Your > > > > > > registration information was > > > > > > accepted'); > > > $this->Session->write('user', > > > > > > $this->data['User']['username']); > > > $this->redirect(array('action' > > > > => > > > > > > 'index'), null, true); > > > > > > } > > > > > > else { > > > $this->data['User']['password'] > > > > = > > > > > > ''; > > > $this->Session->setFlash('There > > > > was > > > > > > a problem saving this > > > > > > information'); > > > > > > } > > > > > > } > > > > > > } > > > > > > > function login() > > > > > > { > > > > > > if ($this->data) > > > > > > { > >
Re: Problem in simple file upload
Nope, you called the field "aiman". So when checking for the file, check the field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] On 1 February 2011 22:43, newguy wrote: > Stephen one simple question, this line in upload.cpt > echo $form->input('aiman', array('type' => 'file')); > means that I can upload only file named aiman?? > > > On Feb 1, 2:17 pm, Stephen wrote: > > This error tells me that your form is successfully reaching the correct > > action "upload". > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > syntax > > is correct enough. > > > > On 1 February 2011 21:55, newguy wrote: > > > > > > > > > > > > > > > > > > > > > I tried that, this time no call was made to add action but I got this > > > warning: > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > controllers/components/uploader.php, line 1084] > > > > > This is the foreach in which warning is coming: > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > >if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > { > > >$validExt = true; > > >} > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > Try > > > > > > create('User',array('action' => 'upload', > > > > 'type'=>'file')); ?> ? > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > Hi I am following this uploader plugin to implement simple file > upload > > > > > on my site: > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > but the problem is that when I press the upload button call to a > > > > > unknown action add is made, I dont have any action by the name of > add, > > > > > here is my code: > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > upload score: > > > > > > > / > > > > > index.cpt > > > > > > > > > > Hello, $user['last_name']); ? > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > link('Upload > Score',array('action'=>'upload')); ? > > > > > > > > > > > link('logout', array('action' => 'logout')); > ?> > > > > li> > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > upload.cpt > > > > > // > > > > > > > > > > >echo $form->create('User',array('type'=>'file')); > > > > >//echo $form->file('File'); > > > > >echo $form->input('aiman', array('type' => 'file')); > > > > > > >//echo $form->submit('Upload'); > > > > >echo $form->end('Upload2'); > > > > > ?> > > > > > > > now when I press upload2 button I get the following error: > > > > > > > > > > Missing Method in UsersController > > > > > Error: The action add is not defined in controller UsersController > > > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > > users_controller.php. > > > > > > > > > > > class UsersController extends AppController { > > > > > > >var $name = 'Users'; > > > > > > >function add() { > > > > > > >} > > > > > > > } > > > > > ?> > > > > > /// > > > > > > > Here is my controller: > > > > > > > > > > > > > class UsersController extends AppController > > > > > { > > > > >var $name = 'Users'; > > > > >var $helpers = array('Html', 'Form'); > > > > >var $components = array('Uploader.Uploader'); > > > > > > >function register() > > > > >{ > > > > >if (!empty($this->data)) > > > > >{ > > > > >$this->data['User']['password'] = > > > > > md5($this->data['User'] > > > > > ['password']); > > > > >if ($this->User->save($this->data)) > > > > >{ > > > > > > $this->Session->setFlash('Your > > > > > registration information was > > > > > accepted'); > > > > > > $this->Session->write('user', > > > > > $this->data['User']['username']); > > > > > > > > $this->redirect(array('action' > > > => > > > > > 'index'), null, true); > > > > >} > > > > >else { > > > > > > $this->data['User']['password'] > > > = > > > > > ''; > > > > > > $this->Session->setFlash('There > > > was > > > > > a problem saving this > > > > > information'); > > > > > } > > > > >} > > > > >} > > > > > > > function login() > > > > >{ > > > > >if ($this->data) > > > > >{ > > > > >$results = > > > > > $this->User->findByUsername($this->data['User'] > > > > > ['username']); > > > > >if ($results && $results['User']['password'] > == > > > > > md5($this- > > > > > >data['User'] ['passwo
Re: Problem in simple file upload
Stephen one simple question, this line in upload.cpt echo $form->input('aiman', array('type' => 'file')); means that I can upload only file named aiman?? On Feb 1, 2:17 pm, Stephen wrote: > This error tells me that your form is successfully reaching the correct > action "upload". > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The syntax > is correct enough. > > On 1 February 2011 21:55, newguy wrote: > > > > > > > > > > > I tried that, this time no call was made to add action but I got this > > warning: > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > controllers/components/uploader.php, line 1084] > > > This is the foreach in which warning is coming: > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > { > > $validExt = true; > > } > > > also I could not find the file uploaded in tmp folder under app. > > > On Feb 1, 1:44 pm, Stephen wrote: > > > Try > > > > create('User',array('action' => 'upload', > > > 'type'=>'file')); ?> ? > > > > On 1 February 2011 21:41, newguy wrote: > > > > > Hi I am following this uploader plugin to implement simple file upload > > > > on my site: > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > but the problem is that when I press the upload button call to a > > > > unknown action add is made, I dont have any action by the name of add, > > > > here is my code: > > > > > After log in user is directed to index.cpt which has the option to > > > > upload score: > > > > > / > > > > index.cpt > > > > > > > > Hello, > > > > > > > > Welcome to Game Web Site > > > > > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > > > > > link('logout', array('action' => 'logout')); ?> > > > li> > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > upload.cpt > > > > // > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > //echo $form->file('File'); > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > //echo $form->submit('Upload'); > > > > echo $form->end('Upload2'); > > > > ?> > > > > > now when I press upload2 button I get the following error: > > > > > > > > Missing Method in UsersController > > > > Error: The action add is not defined in controller UsersController > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > users_controller.php. > > > > > > > > class UsersController extends AppController { > > > > > var $name = 'Users'; > > > > > function add() { > > > > > } > > > > > } > > > > ?> > > > > /// > > > > > Here is my controller: > > > > > > > > > class UsersController extends AppController > > > > { > > > > var $name = 'Users'; > > > > var $helpers = array('Html', 'Form'); > > > > var $components = array('Uploader.Uploader'); > > > > > function register() > > > > { > > > > if (!empty($this->data)) > > > > { > > > > $this->data['User']['password'] = > > > > md5($this->data['User'] > > > > ['password']); > > > > if ($this->User->save($this->data)) > > > > { > > > > $this->Session->setFlash('Your > > > > registration information was > > > > accepted'); > > > > $this->Session->write('user', > > > > $this->data['User']['username']); > > > > > $this->redirect(array('action' > > => > > > > 'index'), null, true); > > > > } > > > > else { > > > > $this->data['User']['password'] > > = > > > > ''; > > > > $this->Session->setFlash('There > > was > > > > a problem saving this > > > > information'); > > > > } > > > > } > > > > } > > > > > function login() > > > > { > > > > if ($this->data) > > > > { > > > > $results = > > > > $this->User->findByUsername($this->data['User'] > > > > ['username']); > > > > if ($results && $results['User']['password'] == > > > > md5($this- > > > > >data['User'] ['password'])) > > > > { > > > > $this->Session->write('user', > > > > $this->data['User']['username']); > > > > $this->redirect(array('action' > > => > > > > 'upload'), null, true); > > > > } > > > > else { > > > >
Re: Problem in simple file upload
This error tells me that your form is successfully reaching the correct action "upload". Check that $this->__mimeTypes is valid, it sounds like it isn't. The syntax is correct enough. On 1 February 2011 21:55, newguy wrote: > I tried that, this time no call was made to add action but I got this > warning: > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > controllers/components/uploader.php, line 1084] > > This is the foreach in which warning is coming: > foreach ($this->__mimeTypes as $grouping => $mimes) { >if (isset($mimes[$this->__data[$this->__current]['ext']])) > { >$validExt = true; >} > > also I could not find the file uploaded in tmp folder under app. > > > On Feb 1, 1:44 pm, Stephen wrote: > > Try > > > > create('User',array('action' => 'upload', > > 'type'=>'file')); ?> ? > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > > > > > > > > > > > > > > Hi I am following this uploader plugin to implement simple file upload > > > on my site: > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > but the problem is that when I press the upload button call to a > > > unknown action add is made, I dont have any action by the name of add, > > > here is my code: > > > > > After log in user is directed to index.cpt which has the option to > > > upload score: > > > > > / > > > index.cpt > > > > > > Hello, > > > > > > Welcome to Game Web Site > > > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > > > link('logout', array('action' => 'logout')); ?> > > li> > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > upload.cpt > > > // > > > > > > >echo $form->create('User',array('type'=>'file')); > > >//echo $form->file('File'); > > >echo $form->input('aiman', array('type' => 'file')); > > > > >//echo $form->submit('Upload'); > > >echo $form->end('Upload2'); > > > ?> > > > > > now when I press upload2 button I get the following error: > > > > > > Missing Method in UsersController > > > Error: The action add is not defined in controller UsersController > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > users_controller.php. > > > > > > > class UsersController extends AppController { > > > > >var $name = 'Users'; > > > > >function add() { > > > > >} > > > > > } > > > ?> > > > /// > > > > > Here is my controller: > > > > > > > > > class UsersController extends AppController > > > { > > >var $name = 'Users'; > > >var $helpers = array('Html', 'Form'); > > >var $components = array('Uploader.Uploader'); > > > > >function register() > > >{ > > >if (!empty($this->data)) > > >{ > > >$this->data['User']['password'] = > > > md5($this->data['User'] > > > ['password']); > > >if ($this->User->save($this->data)) > > >{ > > >$this->Session->setFlash('Your > > > registration information was > > > accepted'); > > >$this->Session->write('user', > > > $this->data['User']['username']); > > > > >$this->redirect(array('action' > => > > > 'index'), null, true); > > >} > > >else { > > >$this->data['User']['password'] > = > > > ''; > > >$this->Session->setFlash('There > was > > > a problem saving this > > > information'); > > > } > > >} > > >} > > > > > function login() > > >{ > > >if ($this->data) > > >{ > > >$results = > > > $this->User->findByUsername($this->data['User'] > > > ['username']); > > >if ($results && $results['User']['password'] == > > > md5($this- > > > >data['User'] ['password'])) > > >{ > > >$this->Session->write('user', > > > $this->data['User']['username']); > > >$this->redirect(array('action' > => > > > 'upload'), null, true); > > >} > > >else { > > >$this->set('error', true); > > > } > > >} > > >} > > > > > function logout() > > >{ > > >$this->Session->delete('user'); > > >$this->redirect(array('action' => 'login'), null, true); > > >} > > > > >function index() > > >{ > > >$
Re: Problem in simple file upload
I tried that, this time no call was made to add action but I got this warning: Invalid argument supplied for foreach() [APP/plugins/uploader/ controllers/components/uploader.php, line 1084] This is the foreach in which warning is coming: foreach ($this->__mimeTypes as $grouping => $mimes) { if (isset($mimes[$this->__data[$this->__current]['ext']])) { $validExt = true; } also I could not find the file uploaded in tmp folder under app. On Feb 1, 1:44 pm, Stephen wrote: > Try > > create('User',array('action' => 'upload', > 'type'=>'file')); ?> ? > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > > > > Hi I am following this uploader plugin to implement simple file upload > > on my site: > > >http://www.milesj.me/resources/script/uploader-plugin > > > but the problem is that when I press the upload button call to a > > unknown action add is made, I dont have any action by the name of add, > > here is my code: > > > After log in user is directed to index.cpt which has the option to > > upload score: > > > / > > index.cpt > > > > Hello, > > > > Welcome to Game Web Site > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > link('logout', array('action' => 'logout')); ?> > li> > > > > > On clicking Upload score link upload action is called > > > > > upload.cpt > > // > > > > echo $form->create('User',array('type'=>'file')); > > //echo $form->file('File'); > > echo $form->input('aiman', array('type' => 'file')); > > > //echo $form->submit('Upload'); > > echo $form->end('Upload2'); > > ?> > > > now when I press upload2 button I get the following error: > > > > Missing Method in UsersController > > Error: The action add is not defined in controller UsersController > > > Error: Create UsersController::add() in file: app/controllers/ > > users_controller.php. > > > > class UsersController extends AppController { > > > var $name = 'Users'; > > > function add() { > > > } > > > } > > ?> > > /// > > > Here is my controller: > > > > > class UsersController extends AppController > > { > > var $name = 'Users'; > > var $helpers = array('Html', 'Form'); > > var $components = array('Uploader.Uploader'); > > > function register() > > { > > if (!empty($this->data)) > > { > > $this->data['User']['password'] = > > md5($this->data['User'] > > ['password']); > > if ($this->User->save($this->data)) > > { > > $this->Session->setFlash('Your > > registration information was > > accepted'); > > $this->Session->write('user', > > $this->data['User']['username']); > > > $this->redirect(array('action' => > > 'index'), null, true); > > } > > else { > > $this->data['User']['password'] = > > ''; > > $this->Session->setFlash('There was > > a problem saving this > > information'); > > } > > } > > } > > > function login() > > { > > if ($this->data) > > { > > $results = > > $this->User->findByUsername($this->data['User'] > > ['username']); > > if ($results && $results['User']['password'] == > > md5($this- > > >data['User'] ['password'])) > > { > > $this->Session->write('user', > > $this->data['User']['username']); > > $this->redirect(array('action' => > > 'upload'), null, true); > > } > > else { > > $this->set('error', true); > > } > > } > > } > > > function logout() > > { > > $this->Session->delete('user'); > > $this->redirect(array('action' => 'login'), null, true); > > } > > > function index() > > { > > $username = $this->Session->read('user'); > > if ($username) > > { > > $results = $this->User->findByUsername($username); > > $this->set('user', $results['User']); > > } > > else { > > $this->redirect(array('action' => 'login'), null, > > true); > > } > > } > > > function downloads() > > { > > } > > > function upload() > > { > > > if (!empty($this->data)) > >
Re: Problem in simple file upload
Try create('User',array('action' => 'upload', 'type'=>'file')); ?> ? On 1 February 2011 21:41, newguy wrote: > Hi I am following this uploader plugin to implement simple file upload > on my site: > > http://www.milesj.me/resources/script/uploader-plugin > > but the problem is that when I press the upload button call to a > unknown action add is made, I dont have any action by the name of add, > here is my code: > > After log in user is directed to index.cpt which has the option to > upload score: > > / > index.cpt > > Hello, > > Welcome to Game Web Site > > link('Downloads',array('action'=>'downloads')); ? > > > link('Upload Score',array('action'=>'upload')); ? > > > link('logout', array('action' => 'logout')); ?> li> > > > On clicking Upload score link upload action is called > > > upload.cpt > // > > echo $form->create('User',array('type'=>'file')); >//echo $form->file('File'); >echo $form->input('aiman', array('type' => 'file')); > >//echo $form->submit('Upload'); >echo $form->end('Upload2'); > ?> > > now when I press upload2 button I get the following error: > > Missing Method in UsersController > Error: The action add is not defined in controller UsersController > > Error: Create UsersController::add() in file: app/controllers/ > users_controller.php. > > class UsersController extends AppController { > >var $name = 'Users'; > > >function add() { > >} > > } > ?> > /// > > Here is my controller: > > > > class UsersController extends AppController > { >var $name = 'Users'; >var $helpers = array('Html', 'Form'); >var $components = array('Uploader.Uploader'); > >function register() >{ >if (!empty($this->data)) >{ >$this->data['User']['password'] = > md5($this->data['User'] > ['password']); >if ($this->User->save($this->data)) >{ >$this->Session->setFlash('Your > registration information was > accepted'); >$this->Session->write('user', > $this->data['User']['username']); > >$this->redirect(array('action' => > 'index'), null, true); >} >else { >$this->data['User']['password'] = > ''; >$this->Session->setFlash('There was > a problem saving this > information'); > } >} >} > > > > function login() >{ >if ($this->data) >{ >$results = > $this->User->findByUsername($this->data['User'] > ['username']); >if ($results && $results['User']['password'] == > md5($this- > >data['User'] ['password'])) >{ >$this->Session->write('user', > $this->data['User']['username']); >$this->redirect(array('action' => > 'upload'), null, true); >} >else { >$this->set('error', true); > } >} >} > > > > function logout() >{ >$this->Session->delete('user'); >$this->redirect(array('action' => 'login'), null, true); >} > > >function index() >{ >$username = $this->Session->read('user'); >if ($username) >{ >$results = $this->User->findByUsername($username); >$this->set('user', $results['User']); >} >else { >$this->redirect(array('action' => 'login'), null, > true); > } >} > > > >function downloads() >{ >} > > > > function upload() >{ > >if (!empty($this->data)) > { >if ($data = $this->Uploader->upload('nam')) > { >// nam is the file name >//var_dump($this->data); print ''; > > $this->redirect(array('action'=>'login'),null,true); >} > } > >} > > } > ?> > > > Please Help me to uplaod this file . > > Thanks > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php > --
Problem in simple file upload
Hi I am following this uploader plugin to implement simple file upload on my site: http://www.milesj.me/resources/script/uploader-plugin but the problem is that when I press the upload button call to a unknown action add is made, I dont have any action by the name of add, here is my code: After log in user is directed to index.cpt which has the option to upload score: / index.cpt Hello, Welcome to Game Web Site link('Downloads',array('action'=>'downloads')); ? > link('Upload Score',array('action'=>'upload')); ? > link('logout', array('action' => 'logout')); ?> On clicking Upload score link upload action is called upload.cpt // create('User',array('type'=>'file')); //echo $form->file('File'); echo $form->input('aiman', array('type' => 'file')); //echo $form->submit('Upload'); echo $form->end('Upload2'); ?> now when I press upload2 button I get the following error: Missing Method in UsersController Error: The action add is not defined in controller UsersController Error: Create UsersController::add() in file: app/controllers/ users_controller.php. /// Here is my controller: data)) { $this->data['User']['password'] = md5($this->data['User'] ['password']); if ($this->User->save($this->data)) { $this->Session->setFlash('Your registration information was accepted'); $this->Session->write('user', $this->data['User']['username']); $this->redirect(array('action' => 'index'), null, true); } else { $this->data['User']['password'] = ''; $this->Session->setFlash('There was a problem saving this information'); } } } function login() { if ($this->data) { $results = $this->User->findByUsername($this->data['User'] ['username']); if ($results && $results['User']['password'] == md5($this- >data['User'] ['password'])) { $this->Session->write('user', $this->data['User']['username']); $this->redirect(array('action' => 'upload'), null, true); } else { $this->set('error', true); } } } function logout() { $this->Session->delete('user'); $this->redirect(array('action' => 'login'), null, true); } function index() { $username = $this->Session->read('user'); if ($username) { $results = $this->User->findByUsername($username); $this->set('user', $results['User']); } else { $this->redirect(array('action' => 'login'), null, true); } } function downloads() { } function upload() { if (!empty($this->data)) { if ($data = $this->Uploader->upload('nam')) { // nam is the file name //var_dump($this->data); print ''; $this->redirect(array('action'=>'login'),null,true); } } } } ?> Please Help me to uplaod this file . Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php