2017-03-27 13 views
0

xlsx를 csv로 변환하고 데이터베이스에서 작업하는 모듈에서 작동합니다. PHP로 작성했지만 이제는 CodeIgniter로 처리해야합니다. 업로드 버튼을 누른 상태에서 좀 "무한 로딩"이CodeIgniter를 사용하여 xlsx 업로드하기

, 아무것도 발생하지 않습니다 :

여기 내 주요 문제입니다. 여기

내 컨트롤러

public function convert(){ 

     $config['upload_path'] = FCPATH.'views/admin/traitement_xslx/csv'; 
     $config['allowed_types'] = 'xlsx|csv|xls'; 
     $config['max_size'] = '1000000000'; 
     $config['overwrite'] = true; 
     $config['encrypt_name'] = FALSE; 
     $config['remove_spaces'] = TRUE; 

     $this->upload->initialize($config); 

     if (! $this->upload->do_upload('xlsxfile')) 
     { 
      echo 'no'; 
     } 
     else 
     { 
      echo 'ok'; 
     } 
    } 

그리고 이것은 내보기

<!DOCTYPE HTML> 
    <html> 
    <head> 
    <meta http-equiv="content-type" content="text/html;charset=utf-8"> 
    <?php echo $redir; ?>  
     <script type="text/javascript"> 
      function message(){ 
      document.getElementById("msg").innerHTML="Conversion<blink>... </blink>"; 
      } 

     </script> 
    </head> 
     <body >  
     <div id="container" style="display:inline-block;"> 
      <h3 class="alert" id="msg"><?php echo $alert; ?></h3> 
      <p>Selectionnez un fichier XLSX à convertir et traiter :</p> 

      <form action="<?= site_url('admin/Traitement_doublons/convert'); ?>" method="post" enctype="multipart/form-data"> 

       <input type="file" name="xlsxfile" size="40" /> 
       <input type="hidden" name="convert"> 
       <br /> 
       <br /> 
       <input type="text" name="throttle" id="throttle" value="0" onkeyup="this.value=this.value.replace(/[^\d]/,\'\')" size="5"> # de lignes à convertir (0 = No limit) <br /> 
       <br /> 
       <input type="submit" class="button" name ="upload" onClick="message()" value="Convertir en CSV et traiter" /> 
      </form> 
     </div> 


     <div id="container" style="display:inline-block;"> 
      <h3 class="alert" id="msg"><?php echo $alert2; ?></h3> 
      <p>Où un fichier CSV à seulement traiter :</p> 

      <form action="#" method="post" enctype="multipart/form-data"> 

       <input type="file" name="csvfile" size="40" /> 
       <input type="hidden" name="convertcsv"> 
       <br /> 
       <br /> 
       <input type="text" name="throttlecsv" id="throttle" value="0" onkeyup="this.value=this.value.replace(/[^\d]/,\'\')" size="5"> # de lignes à convertir (0 = No limit) <br /> 
       <br /> 
       <input type="submit" class="button" name = "uploadcsv" onClick="message()" value="Traiter les données" /> 
      </form> 
     </div> 
     <div> 
      <p><?php if(isset($_SESSION['champs']['total'])){ echo $_SESSION['champs']['total']; }?></p> 
      <p><?php if(isset($_SESSION['champs']['inseres'])){ echo $_SESSION['champs']['inseres']; }?></p> 
      <p><?php if(isset($_SESSION['champs']['doublons'])){ echo $_SESSION['champs']['doublons']; }?></p> 
     </div> 
    </body> 
</html> 

어떤 아이디어가? 감사

답변

0

첫째, 을 선택하면 ($ _ FILES [ 'csvfile'] [ '크기']> 0), 파일 $의 설정에 이름을 추가 [ 'FILE_NAME'] = $ NEW_NAME;을 입력 한 다음 do_upload 함수에 입력 파일 이름을 입력하십시오. (! $ this-> upload-> do_upload ('csvfile')).