Hi,

It seems that you didn't read my replies carefully. I asked you twice about
correcting field names in view (e.g., 'filedata' instead of
'Image/filedata') but still you didn't do it.

If you are coding anything using CakePHP without learning the basics, then
please refer http://book.cakephp.org first and try to build a basic blog
application (http://book.cakephp.org/view/1528/Blog).

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 1:56 PM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> this is my view
> what changes should i do with this?
>
> <h2>Upload An Image</h2>
> <?php echo $this->Form->create('Image',
> array('action'=>'admin_upload', 'type' => 'file'));?>
>         <fieldset>
>                <legend>
>                        Images
>                </legend>
>                <ul>
>                        <li>
>                                <?php echo $form->label('Image/images',
> 'Image:' );?>
>                                <?php echo $form->file('Image/filedata');?>
>                        </li>
>                </ul>
>        </fieldset>
>        <p><input type="submit" name="add" value="Add Image" /></p>
> </form>
>
>
>
> On Jan 20, 12:38 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > Hi,
> >
> > Have you corrected field names in view (e.g., 'filedata' instead
> > of 'Image/filedata')?
> >
> > Also provide 'type' as 'file' to Form->create(). For example, <?php echo
> > $this->Form->create('Image', array('action'=>'admin_upload', 'type' =>
> > 'file'));?>
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Jan 20, 2011 at 12:37 PM, andy_the ultimate baker <
> >
> > anandghaywankar...@gmail.com> wrote:
> > > even by using
> > > $file = $this->data['Image']['filedata'];
> > > i m still getting an error. this time like bellow
> >
> > > Undefined index:  filedata [APP/controllers/images_controller.php,
> > > line 19]
> >
> > > now what???
> >
> > > On Jan 20, 11:58 am, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > > > Hi,
> >
> > > > Why are you using field names in 'Modelname/fieldname' pattern
> instead of
> > > > just 'fieldname'? For example, you need to use 'filedata' instead of
> > > > 'Image/filedata'
> > > > as you have already given 'Image' as first parameter for
> Form->create();
> >
> > > > Also the code in controller's action is
> >
> > > > $file = $this->data['Image']['images'];
> >
> > > > but it should be
> >
> > > > $file = $this->data['Image']['filedata'];
> >
> > > > as the file upload field's name is 'filedata', not 'images'.
> >
> > > > Hope this helps.
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Thu, Jan 20, 2011 at 12:08 PM, andy_the ultimate baker <
> >
> > > > anandghaywankar...@gmail.com> wrote:
> > > > > Undefined index:  images [APP/controllers/images_controller.php,
> line
> > > > > 19]
> >
> > > > > and
> >
> > > > > Cannot modify header information - headers already sent by (output
> > > > > started at /home/satish/anand/cakephp/cake/libs/debugger.php:673)
> > > > > [CORE/cake/libs/controller/controller.php, line 742]
> >
> > > > > On Jan 20, 11:08 am, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > > > > > Hi,
> >
> > > > > > What is the error you are facing?
> >
> > > > > > Amit Badkas
> >
> > > > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > > > On Thu, Jan 20, 2011 at 11:17 AM, andy_the ultimate baker <
> >
> > > > > > anandghaywankar...@gmail.com> wrote:
> > > > > > > hi there,
> > > > > > > i working on image uploading, but i m facing an error,
> > > > > > > can any one solve the issue,
> >
> > > > > > > //this is my controller file image_controller.php
> >
> > > > > > > <?php
> > > > > > > class ImagesController extends AppController {
> >
> > > > > > >        var $name = 'Images';
> > > > > > >        var $helpers = array('Html', 'Form');
> > > > > > >        var $components = array('Upload');
> >
> > > > > > >        function admin_upload() {
> >
> > > > > > >                if (empty($this->data)) {
> > > > > > >                        $this->render();
> > > > > > >                } else {
> > > > > > >                        //$this->cleanUpFields();
> >
> > > > > > >                        // set the upload destination folder
> > > > > > >                        $destination =
> > > > > > > realpath('../../app/webroot/img/uploads/');
> >
> > > > > > >                        // grab the file
> > > > > > >                        $file = $this->data['Image']['images'];
> >
> > > > > > >                        // upload the image using the upload
> > > component
> > > > > > >                        $result = $this->Upload->upload($file,
> > > > > $destination,
> > > > > > > null,
> > > > > > > array('type' => 'resizecrop', 'size' => array('400', '300'),
> > > 'output'
> > > > > > > => 'jpg'));
> >
> > > > > > >                        if (!$result){
> > > > > > >                                $this->data['Image']['images'] =
> > > > > > > $this->Upload->result;
> > > > > > >                        } else {
> > > > > > >                                // display error
> > > > > > >                                $errors = $this->Upload->errors;
> >
> > > > > > >                                // piece together errors
> > > > > > >                                if(is_array($errors)){ $errors =
> > > > > > > implode("<br />",$errors); }
> >
> > > > >  $this->Session->setFlash($errors);
> >
> > > > >  $this->redirect('/images/upload');
> > > > > > >                                        exit();
> > > > > > >                                }
> > > > > > >                        if ($this->Image->save($this->data)) {
> > > > > > >                                $this->Session->setFlash('Image
> has
> > > been
> > > > > > > added.');
> > > > > > >
>  $this->redirect('/images/index');
> > > > > > >                        } else {
> > > > > > >                                $this->Session->setFlash('Please
> > > correct
> > > > > > > errors below.');
> >
> > > > >  unlink($destination.$this->Upload->result);
> > > > > > >                        }
> > > > > > >                }
> > > > > > >        }
> > > > > > > }
> > > > > > > ?>
> >
> > > > > > > //this is my view admin_upload.ctp
> >
> > > > > > > <h2>Upload An Image</h2>
> > > > > > > <?php echo $this->Form->create('Image',
> > > > > > > array('action'=>'admin_upload'));?>
> > > > > > >        <fieldset>
> > > > > > >                <legend>
> > > > > > >                        Images
> > > > > > >                </legend>
> > > > > > >                <ul>
> > > > > > >                        <li>
> > > > > > >                                <?php echo
> > > $form->label('Image/images',
> > > > > > > 'Image:' );?>
> > > > > > >                                <?php echo
> > > > > $form->file('Image/filedata');?>
> > > > > > >                        </li>
> > > > > > >                </ul>
> > > > > > >        </fieldset>
> > > > > > >        <p><input type="submit" name="add" value="Add Image"
> /></p>
> > > > > > > </form>
> >
> > > > > > > pleaase help me as soon as possible
> >
> > > > > > > --
> > > > > > > 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+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> >
> > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> > > <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> <cake-php%25252bunsubscr...@googlegroups.com<cake-php%2525252bunsubscr...@googlegroups.com>
> >
> > > >>For
> > > > > more options, visit this group at
> > > > > > >http://groups.google.com/group/cake-php
> >
> > > > > --
> > > > > 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+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> >
> > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >>For
> > > more options, visit this group at
> > > > >http://groups.google.com/group/cake-php
> >
> > > --
> > > 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+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>>For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php
>
> --
> 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<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
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

Reply via email to