2014-01-25 29 views
0

我正在使用codeigniter,並且以下代碼已運行了很長時間,直到我的服務器更新到PHP 5.4。我的要求是允許大量上傳的文件,並將它們作爲一個blob保存在mysql數據庫中。我無法存儲鏈接引用,因此這不是一個選項。Codeigniter消息:參數3到mysqli_stmt_bind_param()預期爲引用,值給定 - stmt_send_long_data

以下是我的代碼。我得到的錯誤是

Message: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given 

從外觀的東西我傳遞一切通過引用。

任何幫助將是偉大的。

function UploadFile($filepath, $contenttype, $fileext, $filename, $filesize) 
{ 
    $stmt = $this->db->call_function('stmt_init',$this->db->conn_id); 
    if($this->db->call_function('stmt_prepare',$stmt, 'INSERT INTO THE_TABLE (user_id, upload_description, upload, content_type, file_ext, file_name, file_size) VALUES(?,?,?,?,?,?,?)')) 
    { 
     $clientId = $this->input->post('clientid'); 
     $desc = $this->input->post('uploaddescription'); 
     $userfile = $this->input->post('userfile'); 

     $param = 2; 
     $chunkSize = 8192; 

     $this->db->call_function('stmt_bind_param',$stmt, "isbssss", $clientId, $desc, $userfile, $contenttype, $fileext, $filename, $filesize); 

     if ($fp = @fopen($_FILES['userfile']['tmp_name'], 'r')) 
     { 
      while (!feof($fp)) 
      { 

       $this->db->call_function('stmt_send_long_data',$stmt, $param, fread($fp, $chunkSize)); 

      } 
      fclose($fp); 
     } 

     $result_query = $this->db->call_function('stmt_execute', $stmt); 

回答

0

我終於想出了答案。

Codeigniters函數$ this-> db-> call_function通過值傳遞值而不是通過引用傳遞值。我刪除了這個函數調用,並直接調用綁定參數,它工作。

相關問題