cake php wrong form object create issue with Meioupload class

61 views Asked by At

Hi my issue is when i submit form in cake php it is creating wrong model object.

I have tried all possible solution but still not any success please have look at my code

Below is my form PHP code. I have given correct model name "Quote" though I am getting competition object. you can also see object created when i have submitted form.

<?php echo $this->Form->create('Quote', array('type' => 'file')); ?>
 <fieldset>
  <legend><?php echo __('Add Quote'); ?></legend>
 <?php
  echo $this->Form->input('quote');
  echo $this->Form->input('author');
  echo $this->Form->input('file_name',array('type'=>'file'));
  echo $this->Form->input('button_label');
 ?>
 </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
 <h3><?php echo __('Actions'); ?></h3>
 <ul>

  <li><?php echo $this->Html->link(__('List Quotes'), array('action' => 'index')); ?></li>
 </ul>

After form submitting below object create thats why i got error undefined index:competition

Object should be created Quote Object

Competition Object
(
    [actsAs] => Array
        (
            [Sluggable.Sluggable] => Array
                (
                    [label] => title
                    [slug] => slug
                    [separator] => -
                    [overwrite] => 1
                )

            [Containable] => 
            [MeioUpload] => Array
                (
                    [file_name] => Array
                        (
                            [dir] => img{DS}widget_images
                            [create_directory] => 1
                            [allowed_mime] => Array
                                (
                                    [0] => image/jpeg
                                    [1] => image/pjpeg
                                    [2] => image/png
                                    [3] => image/gif
                                )

                            [allowed_ext] => Array
                                (
                                    [0] => .jpg
                                    [1] => .jpeg
                                    [2] => .png
                                    [3] => .JPG
                                    [4] => .JPEG
                                    [5] => .PNG
                                    [6] => .gif
                                    [7] => .GIF
                                )

                            [default] => default.jpg
                        )

                )

        )

    [validate] => Array
        (
            [title] => Array
                (
                    [notEmpty] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => notEmpty
                                )

                        )

                )

            [details] => Array
                (
                    [notEmpty] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => notEmpty
                                )

                        )

                )

            [end_date] => Array
                (
                    [date] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => date
                                )

                        )

                )

            [file_name] => Array
                (
                    [FieldName] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckFieldName
                                )

                            [check] => 1
                            [message] => Este campo não foi definido entre os parâmetros do MeioUploadBehavior.
                        )

                    [Dir] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckDir
                                )

                            [check] => 1
                            [message] => O diretório onde este arquivo seria colocado não existe ou é protegido contra escrita.
                        )

                    [UploadError] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckUploadError
                                )

                            [check] => 1
                            [message] => There was a problem with that upload.
                        )

                    [MaxSize] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckMaxSize
                                )

                            [check] => 1
                            [message] => File exceeds max file size.
                        )

                    [InvalidMime] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckInvalidMime
                                )

                            [check] => 1
                            [message] => Invalid mime type.
                        )

                    [InvalidExt] => Array
                        (
                            [rule] => Array
                                (
                                    [0] => uploadCheckInvalidExt
                                )

                            [check] => 1
                            [message] => Invalid file extension.
                        )

                )

        )

    [hasAndBelongsToMany] => Array
        (
            [User] => Array
                (
                    [className] => User
                    [joinTable] => competitions_users
                    [foreignKey] => competition_id
                    [associationForeignKey] => user_id
                    [unique] => keepExisting
                    [conditions] => 
                    [order] => 
                    [limit] => 
                    [offset] => 
                    [finderQuery] => 
                    [with] => CompetitionsUser
                    [dynamicWith] => 1
                    [fields] => 
                )

        )

    [recursive] => -1
    [useDbConfig] => default
    [useTable] => competitions
    [id] => 
    [data] => Array
        (
        )

    [schemaName] => football_new
    [table] => competitions
    [primaryKey] => id
    [_schema:protected] => Array
        (
            [id] => Array
                (
                    [type] => integer
                    [null] => 
                    [default] => 
                    [length] => 11
                    [key] => primary
                )

            [title] => Array
                (
                    [type] => string
                    [null] => 
                    [default] => 
                    [length] => 255
                    [collate] => latin1_swedish_ci
                    [charset] => latin1
                )

            [promo_title] => Array
                (
                    [type] => string
                    [null] => 
                    [default] => 
                    [length] => 255
                    [collate] => latin1_swedish_ci
                    [charset] => latin1
                )

            [details] => Array
                (
                    [type] => text
                    [null] => 
                    [default] => 
                    [length] => 
                    [collate] => latin1_swedish_ci
                    [charset] => latin1
                )

            [end_date] => Array
                (
                    [type] => date
                    [null] => 
                    [default] => 
                    [length] => 
                )

            [filesize] => Array
                (
                    [type] => integer
                    [null] => 
                    [default..  

Please suggest me solution i am very confused. Thanks

0

There are 0 answers