guys please suggest something.
On Feb 1, 2:50 pm, Stephen <step...@ninjacodermonkey.co.uk> 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 <aimanparv...@gmail.com> 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 <step...@ninjacodermonkey.co.uk> 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 <aimanparv...@gmail.com> 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 <step...@ninjacodermonkey.co.uk> wrote:
> > > > > Try
>
> > > > > <?php echo $form->create('User',array('action' => 'upload',
> > > > > 'type'=>'file')); ?> ?
>
> > > > > On 1 February 2011 21:41, newguy <aimanparv...@gmail.com> 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
> > > > > > ////////////////////////
> > > > > > <p>Hello, <?php echo($user['first_name'] . ' ' .
> > $user['last_name']); ?
> > > > > > ></p>
> > > > > > <p>Welcome to Game Web Site</p>
> > > > > > <ul>
> > > > > > <li><?php echo
> > $html->link('Downloads',array('action'=>'downloads')); ?
> > > > > > ></li>
> > > > > > <li><?php echo $html->link('Upload
> > Score',array('action'=>'upload')); ?
> > > > > > ></li>
> > > > > > <li><?php echo $html->link('logout', array('action' => 'logout'));
> > ?></
> > > > > > li>
> > > > > > </ul>
>
> > > > > > On clicking Upload score link upload action is called
>
> > > > > > ////////////////////////
> > > > > > upload.cpt
> > > > > > //////////////////////
>
> > > > > > <?php
> > > > > > 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.
>
> > > > > > <?php
> > > > > > class UsersController extends AppController {
>
> > > > > > var $name = 'Users';
>
> > > > > > function add() {
>
> > > > > > }
>
> > > > > > }
> > > > > > ?>
> > > > > > ///////////////////
>
> > > > > > Here is my controller:
>
> > > > > > <?php
>
> > > > > > 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 '<br/>';
>
> > > > > > $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
> > sitehttp://ask.cakephp.organdhelp
> > > > > > others with their CakePHP related questions.
>
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.c om>
> > <cake-php%2Bunsubscr...@googlegroups.c om>
> > > > <cake-php%2Bunsubscr...@googlegroups.c om>For more options, visit this
> > > > group at
> > > > > >http://groups.google.com/group/cake-php
>
> > > > > --
> > > > > Kind Regards
> > > > > Stephen @ NinjaCoderMonkey
>
> > > > > www.ninjacodermonkey.co.uk
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.c om>
> > <cake-php%2Bunsubscr...@googlegroups.c om>For more options, visit this
> > group at
> > > >http://groups.google.com/group/cake-php
>
> > > --
> > > Kind Regards
> > > Stephen @ NinjaCoderMonkey
>
> > > www.ninjacodermonkey.co.uk
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.c om>For more options, visit this group at
> >http://groups.google.com/group/cake-php
>
> --
> Kind Regards
> Stephen @ NinjaCoderMonkey
>
> www.ninjacodermonkey.co.uk
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment