Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 图像插入包含某些数据的多行,但图像未插入并上载错误_Javascript_Jquery_Sql_Ajax - Fatal编程技术网

Javascript 图像插入包含某些数据的多行,但图像未插入并上载错误

Javascript 图像插入包含某些数据的多行,但图像未插入并上载错误,javascript,jquery,sql,ajax,Javascript,Jquery,Sql,Ajax,我正在使用codeginter和jquery 当我单击添加按钮并打开带有图像字段的多行,然后单击提交时,我得到一个数据错误 在没有图像字段的情况下,它工作正常,但当我插入图像时,确实会出现插入错误 文件位置未移动 是什么导致了这个错误 查看页面 $("#frm_submit2").on('submit', function (e) { e.preventDefault(); $.ajax({ url:

我正在使用
codeginter
jquery

当我单击
添加按钮
并打开带有图像字段的多行,然后单击
提交
时,我得到一个
数据错误

在没有图像字段的情况下,它工作正常,但当我插入图像时,确实会出现
插入错误

文件位置未移动

是什么导致了这个错误

查看页面

$("#frm_submit2").on('submit', function (e) {
           e.preventDefault();
           $.ajax({
               url: '<?php echo base_url() ?>quick-add-lab-report',
               type: 'POST',
               data: $("#frm_submit2").serialize()
           }).always(function (response){
               var r = (response.trim());
               if(r == 1){
                   $(".success2").show();
               }
               else{
                   $(".danger2").show();
               }
           });
           });

查看表单

<form  id="frm_submit2" action="" method="POST" enctype="multipart/form-data">
                  
                     <input type="hidden" id="getuserid" name="getuserid" value="" class="form-control">
                     <input type="hidden" id="getappid"  name="getappid"  value="" class="form-control">
                     <table class="table table-hover table-center">
                        <thead>
                           <tr>
                              <th width="5%">Sr.No.</th>
                              <th width="30%">Report Name</th>
                              <th width="30%">Report file</th>
                              <th width="30%">Remark's</th>
                              <th width="5%">Add/Remove</th>
                           </tr>
                        </thead>
                        <tbody id="table-details2">
                           <tr id="row2" class="jdr2">
                              <td> 
                                 <span class="btn btn-sm btn-default">1</span>
                                 <input type="hidden" value="6437" name="count[]">
                              </td>
                              <td>
                                 <input type="text" name="report_name[]" placeholder="Report Name" class="form-control">  
                              </td>
                              <td>
                                 <input type="file" name="report_pic[]" placeholder="Report file" class="form-control">  
                              </td>
                              <td>
                                 <input type="text" name="remark[]" placeholder="Remark" class="form-control">  
                              </td>
                              <td>
                                 <button class="btn btn-primary btn-sm btn-add-more-other"><i class="fa fa-plus" aria-hidden="true"></i></button>
                              </td>
                           </tr>
                        <tbody>
                     </table>
                     <div class="submit-section text-center">
                        <input class="btn btn-success"  type="submit" value="submit" name="submit">
                        <button type="button" class="btn btn-danger"style="background-color: #ac2925;" data-dismiss="modal">Close</button>                          
                     </div>
                  </form>
型号

public function quick_add_lab_report(){       
    $result = $this->doctor_health_model->quick_add_lab_report($_POST);
    echo ($result);    
    }
public function quick_add_lab_report($b){ 
    
        $db2        = $this->load->database('dpr',TRUE);
        $uid        = $this->input->post('getuserid');
        $appid      = $this->input->post('getappid');
        
        $j                  = count($b['count']);
        date_default_timezone_set('Asia/Kolkata');
        $today_date         = date("Y-m-d");
        
        
        for($i = 0; $i<$j; $i++){
            /*-------------error-part------------*/
            $filename = $_FILES['report_pic']['name'][$i];
            move_uploaded_file($_FILES['report_pic']['tmp_name'][$i],'../upload/userimage/'.$filename);
            /*--------------end-------------*/
            $data[] = array(
                'created_date'  =>  $today_date,
                'user_id'       =>  $uid,
                'appointment_id'=>  $appid,
                'report_name'   =>  $b['report_name'][$i],
                'report_pic'    =>  $b['report_pic'][$i],
                'remark'        =>  $b['remark'][$i]
                );
            }
        
        $db2->insert_batch('dpr_lab_report', $data); 
        if($db2->affected_rows() > 0)
            return 1;
         else
         return 0;
    }
公共功能快速添加实验室报告($b){ $db2=$this->load->database('dpr',TRUE); $uid=$this->input->post('getuserid'); $appid=$this->input->post('getappid'); $j=计数($b['count']); 日期默认时区设置(“亚洲/加尔各答”); $today_date=日期(“Y-m-d”); 对于($i=0;$i$today\u日期, 'user_id'=>$uid, “约会id”=>$appid, “报告名称”=>$b[“报告名称”][$i], “报告图片”=>$b[“报告图片”][$i], “备注”=>$b[“备注”][$i] ); } $db2->insert_batch('dpr_lab_report',$data); if($db2->infected_rows()>0) 返回1; 其他的 返回0; }