文件已附加但在表单提交后为空

时间:2015-08-31 08:57:04

标签: jquery forms file cakephp

我正在使用jquery插件在附加后立即显示图像。它工作正常。但在表单提交文件输入字段为空之后。我正在使用cakephp 2.6和Form:

的代码
<?php echo $this->Session->flash(); ?>
                        <!-- BEGIN FORM-->
                           <?php echo $this->Form->create('Tolet', array(
                            'inputDefaults' => array(
                                'label' => false,
                                'div'   => false                                  
                                ),
                            'id'=> 'fileupload',
                            'class' => 'form-horizontal form_sample_2',
                            'novalidate' =>'novalidate',
                            'type' => 'file'
                            )
                            ); ?>
        <div class="form-group">
                                    <label class="control-label col-md-5">
                                        <span class="btn green fileinput-button">
                                            <i class="fa fa-plus"></i>
                                            <span>
                                                Add Image </span>

                                               <?php 
                                               echo $this->Form->input(
                                            'images.',

                                            array(
                                                'type' => 'file',
                                                'multiple' =>'',
                                                'class' => 'form-control'
                                                )

                                            ); 
                                            ?>
                                        </span>
                                    </label>
                                    <div class="col-md-7">

                                        <table role="presentation" class="table table-striped clearfix">
                                            <tbody class="files">
                                            </tbody>
                                        </table>
                                    </div>
                                </div>   


  <div class="form-actions">
                                <div class="row">
                                    <div class="col-md-offset-9 col-md-3">

                                         <?php 
                                                                     echo $this->Form->button(
                                                                        'Post', 
                                                                        array('class' => 'btn green', 'type' => 'submit')
                                                                        ); ?>
                                    </div>
                                </div>
                            </div>
                          <?php echo $this->Form->end(); ?>
                        <!-- END FORM-->
                    </div>

请求数据:

Array
(
    [Tolet] => Array
        (
            [title] => 
            [tolet_type_id] => 
            [tolet_condition_id] => 
            [room_no] => 1
            [bath_no] => 1
            [area] => 
            [name] => 
            [cell] => 
            [email] => 
            [images] => Array
                (
                    [0] => Array
                        (
                            [name] => 
                            [type] => 
                            [tmp_name] => 
                            [error] => 4
                            [size] => 0
                        )

                )

        )

)

我做错了什么?这是现场演示:http://demo.jegeachi.com/tolets/add

我很抱歉,如果这是一个非常基本的问题,不应该在stackoverflow中询问。

0 个答案:

没有答案
相关问题